-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
websocket: Fix websocket data being modelled as a stream internally
Currently WebSocket implementation has the following input data path: input_stream -> websocket parser -> queue -> data_sink -> input_stream wrapper On the output side, the data path is as follows: output_stream wrapper -> data_source -> queue -> websocket serializer -> output_stream The input_stream and output_stream wrappers are what is exposed to the user. This is problematic, because WebSocket is a message-based protocol and streams do not have the concept of messages, they model data as a stream of bytes. As a result, the payloads that the user sends or receives will not correspond to a single websocket message, breaking the underlying protocol in most cases. E.g. json or protobuf payloads no longer contain valid data and so on. Currently this behavior is seen on high load, when the stream wrappers start to coalesce and split messages in the write path due to more than one message being available at a time. The solution is to expose data_sink and data_source that are backed by message queues directly to the user.
- Loading branch information
Showing
4 changed files
with
17 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters