Skip to content

Server handles messages out-of-order when beforeHandleMessage is used #880

@raimohanska

Description

@raimohanska

Description

If you use an asynchronous beforeHandleMessage hook, you will very likely have messages handled out-of-order. In here there's no mechanism for guaranteeing processing order.

In many cases this is not an issue, but sometimes it leads to inconsistent transient states when processing Y.js updates out of order. I'm not sure what other effects this may have, as this affects all other incoming WebSocket messages as well.

My suggestion would be to guarantee processing order using a queue mechanism.

Steps to reproduce the bug

Add an asynchronous beforeHandleMessage hook. For worst case, add big random delays in your hook to mess up message processing order totally.

Expected behavior

I would expect messages to be processed FIFO.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions