-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SvelteKit Websocket doesn't work #18191
Comments
Interestingly, I don't experience the same when I follow the provided instructions. Logs on the server:
On the browser
|
@nerg4l Interesting... I also tested both Zen (Firefox-based) and Brave Browser (Chromium-based) and both doesn't work... More info
|
macOS 15.3
I tested with Firefox Developer Edition 137.0b4 and Google Chrome 134.0.6998.89.
I hope this helps. Feel free to ask if you need anything else or if I should test something. |
What version of Bun is running?
1.2.5
What platform is your computer?
Linux 6.11.0-19-generic x86_64 x86_64
What steps can reproduce the bug?
bunx sv create
bun remove @sveltejs/kit @sveltejs/adapter-auto
bun add -D https://pkg.pr.new/sveltejs/kit/@sveltejs/kit@1998d7b6de1c8e3e67a52d9f387a64d3683f5045
bun add -D https://pkg.pr.new/sveltejs/kit/@sveltejs/adapter-node@1998d7b6de1c8e3e67a52d9f387a64d3683f5045
svelte.config.js
to use@sveltejs/adapter-node
ws
insrc/routes
+server.js
insrc/routes/ws/
with the following contentsrc/routes/+page.svelte
to be the followingbunx run dev
orbunx vite dev
localhost:5173
What is the expected behavior?
✅ The server upgrade and connected successfully (logs "upgrade" and "open" to the terminal)
✅ The server receive the "Hello server!" message from the client (logs "Message: Hello server!" to the terminal)
✅ The client successfully connect to the WebSocket server (logs "WebSocket opened!" to the console)
What do you see instead?
✅ The server upgrade and connected successfully (logs "upgrade", "open" to the terminal)
❌ The server did not receive the "Hello server!" message from the client
❌ The client timeout and emit a close event after a while (nothing is logged, after a while, "WebSocket closed!" is logged to the console)
Additional information
I am aware that there is
svelte-adapter-bun
, but the last update was made 5 months ago.The problem with
svelte-adapter-bun
is that WebSocket only work for production build, not dev server, whereas the SvelteKit WebSocket PR works with@sveltejs/adapter-node
andnode
both in production build and dev server.This issue mentions that Bun is "heading in the direction of high node compatability", and mentions that the sveltekit Deno adapter has been deprecated. That's why I want to check if using the SvelteKit Websocket PR with
@sveltejs/adapter-node
with Bun works.The text was updated successfully, but these errors were encountered: