-
Notifications
You must be signed in to change notification settings - Fork 183
Add WebSocket server #705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add WebSocket server #705
Conversation
Interoperability is all over the place. For WebSocket clients - Chromium 138 Developer Build (Linux) { conn: { [Symbol(kHandle)]: {} } } { opcode: 8 } Close opcode. TypeError: Parameter 1 is required in 'respond'. at $ (polyfills.js:28:14849) at respond (polyfills.js:28:21853) at pull (core.js{ conn: { [Symbol(kHandle)]: {} } } { opcode: 8 } Close opcode. WebSocket client connection closed Error: EPIPE: broken pipe :1:11961) - Firefox Nightly 140.0a1 (2025-05-07) (64-bit) Works with 127.0.0.1:8080 Does not work with 0.0.0.0:8080 - Bun 1.2.13 Works with builtin or Undici. Always causes broken pipe in tjs. { conn: { [Symbol(kHandle)]: {} } } { opcode: 8 } Close opcode. WebSocket client connection closed Error: EPIPE: broken pipe - Deno 2.3.1+d372c0d (canary, release, x86_64-unknown-linux-gnu) Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost. - Node.js v24.0.0-nightly202505066102159fa1 Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost. For WebSocketStream clients - Chromium 138 Developer Build (Linux) Works. writer.close() does not cause broken pipe. A different error. Server does not exit. TypeError: Parameter 1 is required in 'respond'. at $ (polyfills.js:28:14849) at respond (polyfills.js:28:21853) at pull (core.js:1:11961) - Deno Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost. - Node.js Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost.
More all over the place with regard to clients. When I adjust the code to use a single resizable This
causes this error
but not when Chromium is the client. |
It should be possible to use subarray() instead of slice() quickjs-ng/quickjs#1052
Updated usage, to handle mutiple requests with the same server instance
Client support update. Chromium client works. Firefox client works. Bun works, and always causes The same code used in Chromium as a |
This explains why Deno
Node.js
Node.js
Chromium
Bun, using Node.js Undici WebSocketStream
Bun, using built-in WebSocket
Firefox
Notice the lowercase
for
After checking for case-insensitive |
Interoperability is all over the place.
For WebSocket clients
{ conn: { [Symbol(kHandle)]: {} } }
{ opcode: 8 }
Close opcode.
TypeError: Parameter 1 is required in 'respond'.
at $ (polyfills.js:28:14849)
at respond (polyfills.js:28:21853)
at pull (core.js{ conn: { [Symbol(kHandle)]: {} } }
{ opcode: 8 }
Close opcode.
WebSocket client connection closed
Error: EPIPE: broken pipe
:1:11961)
Works with 127.0.0.1:8080
Does not work with 0.0.0.0:8080
Works with builtin or Undici. Always causes broken pipe in tjs.
{ conn: { [Symbol(kHandle)]: {} } }
{ opcode: 8 }
Close opcode.
WebSocket client connection closed
Error: EPIPE: broken pipe
Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost.
Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost.
For WebSocketStream clients
Works.
writer.close() does not cause broken pipe. A different error. Server does not exit.
TypeError: Parameter 1 is required in 'respond'.
at $ (polyfills.js:28:14849)
at respond (polyfills.js:28:21853)
at pull (core.js:1:11961)
Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost.
Does nothing. Using builtin or Undici. 0.0.0.0, 127.0.0.1, or localhost.
websocket-client.js
. Echo 1 MB.websocket-stream-client.js
. Echo 7 MB.Usage in
tjs
runtimetjs run tjs-websocket-server.js