Open Thylossus opened 9 years ago
I was wondering about this myself. +1 for an authoritative answer...
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.
@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 :+1:
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 notifications@github.com 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: :+1:]
— Reply to this email directly or view it on GitHub https://github.com/share/ShareJS/issues/375#issuecomment-103801106.
Thanks for the advice, I'll see what I come up with :+1:
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!