Skip to content

Don't process incoming message asynchronously #11

@henvic

Description

@henvic

Just a heads-up with an issue that happened with me.

golang-socketio/channel.go

Lines 156 to 158 in 90487b6

default:
go e.processIncoming(c, decodedMessage)
}

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions