Add WebSocket server library - #5
Merged
Merged
Conversation
Implements the WebSocket server library designed in Discussion #2, built on lori (TCP) and ssl (SHA-1 for handshake accept key). Follows lori/stallion's "your actor IS the connection" pattern where the user's actor owns a WebSocketServer protocol handler instance. Public API: WebSocketServer (protocol handler), WebSocketServerActor (user trait), WebSocketLifecycleEventReceiver (callbacks with default no-ops), WebSocketConfig (immutable config), UpgradeRequest (parsed HTTP upgrade), CloseCode and HandshakeError unions. Internal components: _HandshakeParser (HTTP upgrade), _FrameParser (incremental WebSocket frame parsing), _FrameEncoder (server frames), _FragmentReassembler (message reassembly with UTF-8 validation), _Utf8Validator, and a trait-based state machine (_Handshaking, _Open, _Closing, _Closed). 60 tests (example-based + PonyCheck property tests) covering all parsers, encoder, reassembler, and validator. Echo server example. Design: #2
SeanTAllen
force-pushed
the
sean/websocket-server-library
branch
from
February 22, 2026 22:57
0536cb8 to
c3c5c76
Compare
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.
Initial implementation of a WebSocket server library built on lori. Implements RFC 6455 including the HTTP upgrade handshake, frame parsing and encoding, message fragmentation/reassembly, and the close handshake.
Follows lori/stallion's "your actor IS the connection" pattern: users implement
WebSocketServerActorand the library handles all protocol details, delivering application-level events through lifecycle callbacks.Architecture:
WebSocketServer: protocol handler class (state machine, parsers, encoder)WebSocketServerActor: trait combiningTCPConnectionActor+ lifecycle callbacks_Handshaking->_Open->_Closing->_Closed60 unit tests including PonyCheck property-based tests for all internal components. WSS (TLS) support via
WebSocketServer.ssl()constructor.Design: #2