Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When is the state of the session set to connected when requestSession is established? #20

Open
zhangzsan opened this issue Sep 3, 2019 · 2 comments

Comments

@zhangzsan
Copy link

As the title says

@louaybassbouss
Copy link
Contributor

When the connection is ready to send and receive messages

@zhangzsan
Copy link
Author

When the connection is ready to send and receive messages

Actually when request a presentation session by use the example:

var presentation = navigator.presentation;
var session = presentation.requestSession("my.html");

session.onstatechange = function() {
switch (session.state) {
case 'connected':
session.postMessage(/.../);
session.onmessage = function() { /.../ };
break;
case 'disconnected':
console.log('Disconnected.');
break;
}
};

The code above is to get connection, i think
when execute session.onstatechange, none of the code in the body of the method executes.
Expected to get session.state to execute switch (session.state) but not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants