WebSockets
Open
Nobody has claimed this yet.
websocket
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 880
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 68
Description
permessage-deflate support
- Is this something we need/want to support? Servers that are setup correctly should work even if the client doesn't support it.
- Memory fragmentation issues when using zlib?
- Added complexity of decompressing frames asynchronously
Performance
Consume the least amount of bytes possible, rather than concatenating every chunk available. See ws' implementation.Fixed in 5165d6712088c41ebbf66cf71ba856924008e899Switch to Buffer.allocUnsafe inFixed in b6844f08037cf59bc864a947466756e72c895d92lib/websocket/frame.jsHandle TODO comments labeled as "optimize this".- Benchmarks
Use FastBuffer (Buffer[Symbol.species])
Tests
Add ws' test suite. Note this isn't easy because ws' api does not strictly follow the spec and it occasionally uses internal, underscored properties. Also note that a lot of the validation tests are already handled by the WPTs.Autobahn testsuite100% code coverage for lib/websocketsCode coverage is high enough; WPTs are not counted, which make up a majority of the tests.Test more strange/error conditions:Chunks that contain thousands of framesChunks that receive a pong/close frame in the middle of a fragmented message(Control frames are already handled the same.)Sending invalid frames
Bugs
- using
WebSocket.sendwith a Blob asynchronously writes the blob data to the socket. This can cause issues when concurrently sending a blob with anything else. Note: we need support in node core to read a Blob synchronously. Fixed in 1b858fbcaec4e97550a95038469b1e1d0c979340ByteParser.runruns recursively, meaning the max call stack can be exceeded under certain conditions (ie. receiving thousands of frames in a single chunk).
Features
Setting an undici Dispatcher rather than using the global dispatcher by default.- Letting the client generate the mask for performance reasons.
WebSocketStream
- https://github.com/ricea/websocketstream-explainer
- No real spec, the explainer is superficial.
- API is much better; allows for expansion (ie. second param is a dictionary rather than a list/string).
- Probably much slower
- requires rewrite of WebSocket internals
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
This is a broad WebSocket tracking issue with several completed items and no single remaining scope. Review the unchecked permessage-deflate, Blob-send, benchmarking, and mask-generation points, starting with lib/websocket/frame.js and the current WebSocket entry points; done requires choosing one item, defining its tests, and confirming that focused behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100