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

Socket.io in-order message delivery warning still valid? #375

Open
Thylossus opened this issue May 8, 2015 · 5 comments
Open

Socket.io in-order message delivery warning still valid? #375

Thylossus opened this issue May 8, 2015 · 5 comments

Comments

@Thylossus
Copy link

Hi,

I'm planning to implement a real-time collaboration platform using ShareJS. Since the documentation seems to be a bit outdated, I'm not quite sure whether the warning "Danger danger socket.io does not guarantee [in-order message delivery]" is still valid.

With version 1.x socket.io introduced major changes and therefore I'm asking myself if it might have changed its message delivery properties. However, I was not able to find any information about this.

Is there any new information regarding the compatibility of ShareJS and socket.io?

Thanks!

@vote539
Copy link

vote539 commented May 20, 2015

I was wondering about this myself. +1 for an authoritative answer...

@devongovett
Copy link
Contributor

When using the websocket transport, messages are guaranteed to be in order (thanks to TCP), but other transports supported by socket.io do not guarantee this (e.g. polling), since they may open multiple connections simultaneously (thus creating race conditions).

We ran into this issue when using ShareJS with socket.io at Storify and ended up wrapping the sharejs protocol in our own protocol that guarantees in-order delivery. You basically have to assign a sequence number to each message that increments whenever a message is sent (on both the client and server ends, separately). Both ends then buffer messages that are received out of order until the missing messages come in. Here is an implementation in browserchannel that you can adapt for your own purposes.

@Thylossus
Copy link
Author

@devongovett Thank you for your explanation and the solution! I didn't know that socket.io hasn't implemented in order delivery for their fallback transport mechanisms. Too bad... However, I think with your proposed solution it will also work for my purposes. Therefore thanks again 👍

@wmertens
Copy link
Contributor

and now I wonder how hard it would be to add an in-order option to
socket.io...

On Wed, May 20, 2015 at 10:01 AM Tobias [email protected] wrote:

@devongovett https://github.com/devongovett Thank you for your
explanation and the solution! I didn't know that socket.io hasn't
implemented in order delivery for their fallback transport mechanisms. Too
bad... However, I think with your proposed solution it will also work for
my purposes. Therefore thanks again [image: 👍]


Reply to this email directly or view it on GitHub
#375 (comment).

@vote539
Copy link

vote539 commented May 20, 2015

Thanks for the advice, I'll see what I come up with 👍

vote539 added a commit to vote539/ShareJS that referenced this issue May 20, 2015
Linking issue josephg#375 from README for users interested in Socket.IO.
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

4 participants