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

Clarification of reconnect semantics #500

Closed
pigulla opened this issue Aug 31, 2011 · 1 comment
Closed

Clarification of reconnect semantics #500

pigulla opened this issue Aug 31, 2011 · 1 comment

Comments

@pigulla
Copy link

pigulla commented Aug 31, 2011

I'm developing an application where clients can subscribe to a variety of events fired by the server. These subscriptions are highly parameterized and can thus not be modeled adequately with Socket.IO's channel feature (e.g., the client can subscribe to all events of type X but filter them by field A and only receive fields B and C). The server keeps track of all subscriptions and dispatches incoming events accordingly.

I've looked through the source code but am still having trouble figuring out what exactly happens when a reconnect occurs and how it should be handled. For instance:

  • Should I require the client to authenticate itself again (in our case by sending a token)? I know this is primarily an application issue but it may be relevant if it is possible for a client to trick the server into treating a regular connection attempt as a reconnect. I don't know enough about the Socket.IO protocol to answer this.
  • What happens when the server is restarted and that causes the client to reconnect (in which case the client needs to send all subscribe messages again)? How can I distinguish this from a "client-side" reconnect?
  • How can I simulate a disconnect (i.e., force a reconnect)? I need to do this programmatically in order to write unit tests.
  • If the server closes the connection (e.g. because maintenance requires a restart) and I need to reconnect, how do I do that? Currently I call connection.socket.connect() but I'm not sure that it is intended to be used that way.

Any infos on theses issues are highly appreciated.

@rauchg
Copy link
Contributor

rauchg commented Sep 3, 2011

  • Yes
  • Same as any reconnect.
  • socket.disconnect()
  • Socket.IO reconnects automatically according to the configuration options you provide (see the wiki for more information).

Also, please join the mailing list and #socket.io on freenode! This is only a bug report channel.

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