fix: handle WebSocket RawData correctly for compression support#499
Merged
max246 merged 3 commits intobropat:developfrom Feb 1, 2026
Merged
fix: handle WebSocket RawData correctly for compression support#499max246 merged 3 commits intobropat:developfrom
max246 merged 3 commits intobropat:developfrom
Conversation
The `ws` library's message event provides `RawData` (Buffer | ArrayBuffer | Buffer[]), not `string`. This was causing issues with clients using permessage-deflate compression (e.g., aiohttp with compress=9) where messages appeared to be silently dropped. From @types/ws: ```typescript on(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this; type RawData = Buffer | ArrayBuffer | Buffer[]; ```
max246
approved these changes
Jan 20, 2026
Collaborator
|
@temp-droid thank you! go ahead and merge |
Contributor
Author
|
@max246 The ESLint check is failing due to a version mismatch in the workflow ([email protected] vs the project's [email protected]). |
Collaborator
yeah thats fine. just ... need some love on that task too. Bit busy to catch up on stuff and refactory the client, feel free to make a PR to fix it. |
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wslibrary's message event providesRawData, notstringProblem
Clients using WebSocket compression (e.g., aiohttp with
compress=9) experienced silent message drops. The connection established successfully, but messages were not processed.Root Cause
The
wslibrary types show the message event providesRawData, notstring:The old code incorrectly typed the parameter as
string.Test plan
npm run build# Save as test-compression.mjs and run: node test-compression.mjsExpected output: