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
Force disconnect/login a client that is connected #27
Comments
Disconnecting and connecting again sounds like expected behaviour! You can look at connection for where the functionality would go. By looking at the code it could be something like recreating the endpoint: createEndPoint = function () {
if( utils.isNode() ) {
this._endpoint = new TcpConnection( url );
} else {
this._endpoint = engineIoClient( url, options );
}
this._endpoint.on( 'open', this._onOpen.bind( this ) );
this._endpoint.on( 'error', this._onError.bind( this ) );
this._endpoint.on( 'close', this._onClose.bind( this ) );
this._endpoint.on( 'message', this._onMessage.bind( this ) );
} Then rather than throw the exception in authenticate you can create a new endpoint: if( this._deliberateClose === true && this._state === C.CONNECTION_STATE.CLOSED ) {
this._createEndpoint();
this._deliberateClose = false;
this._client.once( C.EVENT.CONNECTION_STATE_CHANGED, this.authenticate.bind( authParams, callback );
return;
} There will be a couple of other issues you will get due to deepstream client having to resubscribe events / rpcs ( it currently only does it for records and lists ). We started work on this but still haven't decided on the exact approach to take. See #20. Be great if you can add an e2e tests for this. Thanks! |
Hey @jwanglof, Was wondering if you had a chance to look at this / if the approach worked. Thanks! |
@yasserf: I haven't had any time to implement this. We have a working work-around on our frontend regarding connecting/disconnecting that we will be using until this is implemented. Either by you guys or by someone else =) |
Awesome, just wanted to catch up and make sure it isn't a blocker. Our own product will go through a hardening stage which will give us some dedicated bandwidth to target this and other features on our backlog I'll let you know when we pick this up to avoid stepping on each others toes! |
…ect-reconnect Fixes #27 connecting after voluntary disconnect
…dy-event Fixes #27 anonymous record ready event
We have an Android application that is showing our web-application in a web view (we're using Crosswalk's webview, https://crosswalk-project.org/). When the application is loosing its focus (i.e. the user minimizes the application) we need to disconnect our socket, and when the application is regaining its focus we need to login with the socket again. Or is this the wrong way to do it?
We know when the application is loosing focus and when it's regaining focus.
We've tried to close the socket (with
deepstreamClient.close()
), and then login with it again. However, this gives us the error:this client's connection was closed
, which is wanted since we actually closed the socket.What we would need is a
deepstreamClient.disconnect()
or some kind of re-login on the current socket.Is this possible to implement?
I can make a PR if I could get some hints where do add this functionality so you guys don't have to implement this =)
The text was updated successfully, but these errors were encountered: