fix(websocket): handle Blob binaryType for compatibility_date >=2026-03-17 - #1049
Open
ZEROLINGG wants to merge 2 commits into
Open
fix(websocket): handle Blob binaryType for compatibility_date >=2026-03-17#1049ZEROLINGG wants to merge 2 commits into
ZEROLINGG wants to merge 2 commits into
Conversation
…03-17 workerd#6178 changes WebSocket.binaryType default from arraybuffer to blob for compatibility_date >=2026-03-17 (websocket_standard_binary_type). Original MessageEvent::bytes()->Option<Vec<u8>> assumed ArrayBuffer and silently returned [] for Blob (new Uint8Array(Blob).length==0). - WebSocket: expose binary_type()/set_binary_type() proxying web_sys::BinaryType, must be set before accept() to opt back to ArrayBuffer - MessageEvent: split into bytes_from_arraybuffer()->Result<Vec<u8>> (sync), bytes_from_blob().await->Result<Vec<u8>> and unified bytes().await->Result<Vec<u8>> that handles both types; docs cover 2026-04-21 changelog and workerd#6178 - Fix Blob handling via await blob.array_buffer() instead of Uint8Array::new(blob) Refs: https://developers.cloudflare.com/changelog/post/2026-04-21-websocket-standard-binary-type Refs: cloudflare/workerd#6178
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.
workerd#6178 changes WebSocket.binaryType default from arraybuffer to blob for compatibility_date >=2026-03-17 (websocket_standard_binary_type). Original MessageEvent::bytes()->Option<Vec> assumed ArrayBuffer and silently returned [] for Blob (new Uint8Array(Blob).length==0).
Refs: https://developers.cloudflare.com/changelog/post/2026-04-21-websocket-standard-binary-type
Refs: cloudflare/workerd#6178