Skip to content

Return the request path from WebSocket accept - #30

Merged
pbower merged 2 commits into
mainfrom
websocket-accept-path
Nov 20, 2026
Merged

pbower merged 2 commits into
mainfrom
websocket-accept-path

Conversation

@pbower

@pbower pbower commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

WebSocketTransport::accept, WebSocketTransport::accept_tls and SyncWebSocketTransport::accept now return the request path of the accepted connection together with its post-handshake halves. Listening WebSocket sinks need the path to route each connection to its feed, for example /prices.

This replaces the local websocket_accept_path branch, which added a second method, accept_with_path, and left accept discarding the path. Lightning main calls accept_with_path since Lightning #960, and doesn't build against Lightstream main until this PR and the matching Lightning PR merge.

Changes

  • The three accept functions run the server handshake with a callback that records the request path, and return (path, read_half, write_half).
  • The table readers and writers that accept connections take the halves and don't use the path.
  • The Transport implementation for WebSocketTransport returns the halves only, because the trait covers every transport and most of them don't have a request path.
  • The changelog records the change under Breaking Changes.

Testing

  • New tests check that the async and sync accept functions return /prices for a client connecting to ws://<addr>/prices.
  • With websocket, http and tls: 10 transport round-trip tests, including the TLS WebSocket test, 20 sync WebSocket tests and 155 library tests pass.

@pbower
pbower merged commit 327e9f0 into main Nov 20, 2026
18 of 23 checks passed
@pbower
pbower deleted the websocket-accept-path branch November 20, 2026 19:05
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.

1 participant