Skip to content

Add WebSocket client and server#966

Open
Nicell wants to merge 28 commits intoluau-lang:primaryfrom
Nicell:websockets-take-two
Open

Add WebSocket client and server#966
Nicell wants to merge 28 commits intoluau-lang:primaryfrom
Nicell:websockets-take-two

Conversation

@Nicell
Copy link
Copy Markdown
Collaborator

@Nicell Nicell commented Apr 9, 2026

Adds WebSocket support to @lute/net for both clients and servers, including text/binary messaging, upgrade handling, close/drain callbacks, and new examples/tests. There's also some refactoring to simplify server handler setup with the added complexity of WebSockets.

API changes

  • Added client.websocket(url, options) with WebSocket and WebSocketOptions types.
  • Added server-side WebSocket support through server.serve({ websocket = ... }) and Server:upgrade(req) with the ServerWebSocket type.

If a client sends a string, it's treated as a string, if a client is sends a buffer, it's treated as binary. On the server the incoming message can also be either a buffer or string. Depending on which it is you know the websocket data type.

closes #124

@Nicell Nicell requested a review from aatxe April 13, 2026 21:30
@Nicell Nicell marked this pull request as ready for review April 13, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

net: WebSocket Server

1 participant