Skip to content

js: offer WebSocket subprotocols to a Wisp server (wispBackend protocols) - #83

Open
zyx1121 wants to merge 1 commit into
pithings:mainfrom
zyx1121:wisp-protocols
Open

zyx1121 wants to merge 1 commit into
pithings:mainfrom
zyx1121:wisp-protocols

Conversation

@zyx1121

@zyx1121 zyx1121 commented Nov 29, 2026

Copy link
Copy Markdown

A browser can't set handshake headers, so a Wisp proxy that wants a token from a page can only take it from the URL, where it ends up in logs. Browsers do send subprotocols, so this adds protocols next to headers.

wispBackend("wss://wisp.example/", { protocols: ["app.v1", "app.token." + token] })
  • Works with or without headers, and through the wisp NetSpec (worker mode).
  • Nothing changes when the option is not set.

Tested with node --test test/net.test.ts (one new test) and pnpm typecheck. We use it from a browser against a proxy that checks the token.

Reviewed by me before sending.

🤖 Generated with Claude Code

…cols`)

A browser cannot set handshake headers, so a proxy that wants a token
could only take it from the URL. Subprotocols are sent by browsers too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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