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

client does not get a close event from engine.io when device sleeps #67

Closed
yasserf opened this issue Feb 8, 2016 · 1 comment
Closed
Labels

Comments

@yasserf
Copy link
Contributor

yasserf commented Feb 8, 2016

Mostly on android and iOS (and desktop when computer goes to sleep). The client pauses and after a minute the client is logged out on the Deepstream server. When the client is waken up again it (the Deepstream client) doesn’t know it is disconnected. After a minute of a weird in-between-state it realizes it is disconnected and reconnects.

Following is some code that forces a reconnect ( won't run copy/paste )


var latestHeartBeat = Date.now();
var engine = dsClient._connection.endpoint;
if (!
.isUndefined(engine.onHeartbeat)) {
var onHeartBeat = function () {
latestHeartBeat = Date.now();
};
engine.on('heartbeat', onHeartBeat);

var browserAwake = function () {
if (Date.now() - latestHeartBeat > 30000) {
dsClient._connection._endpoint.onClose('ping timeout');
}
};
bus.on( 'browser_awake', browserAwake );

@yasserf yasserf added the bug label Feb 8, 2016
@yasserf
Copy link
Contributor Author

yasserf commented Feb 18, 2016

Closed since producer said it no longer occurs! =D

@yasserf yasserf closed this as completed Feb 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant