Skip to content

is socket data ordered sequential using receiving async client? #865

Answered by miguelgrinberg
Stackerr asked this question in Q&A
Discussion options

You must be logged in to vote

Incoming WebSocket events are dispatched to your application in the order they are received, which is also the order in which they were sent. One possible complication is that sometimes you may end up having two or more handlers running concurrently.

For example, let's say event A is dispatched to your application, and while this event handler is running, event B arrives. With the default configuration, event B will be dispatched, even though the handler for A hasn't completed. If you want the event handlers to be serialized, set async_workers=False when you create your server. Then in the A and B example, B will be received, but it will wait in a queue until the handler for A returns, an…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Stackerr
Comment options

@miguelgrinberg
Comment options

Answer selected by Stackerr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants