golang-socketio
golang-socketio copied to clipboard
Don't process incoming message asynchronously
Just a heads-up with an issue that happened with me.
https://github.com/mtfelian/golang-socketio/blob/90487b63a1683c7eedda3a1d2f2916d58508c151/channel.go#L156-L158
isn't correct because sometimes you want to have a guarantee on the order of incoming messages.
Instead, you want to guarantee the order like so:
https://github.com/wedeploy/gosocketio/blob/ef257277a67693f4f0830594e3829e3e02c4d402/client.go#L257-L259
and let the consumer decides if he swaps a new goroutine for handling the message or handles it on the same one.
If you go to https://asciinema.org/a/192043 (between 1:57 and 2:15) and you see the execution of some shell commands you get why this is fundamental (every key you hit on the keyboard is an event).
Thanks for the issue, I will take a closer look on it later. It's not obvious that if we simply remove go there it will work nominal with both transports. Had there been tests it were helped a lot in resolving such issues.
@mtfelian What is the update on this?