Bun with socket.io #2111
-
Starting with version 4.4.0, a Socket.IO server can now bind to a µWebSockets.js server. const { App } = require("uWebSockets.js");
const { Server } = require("socket.io");
const app = new App();
const io = new Server();
io.attachApp(app);
io.on("connection", (socket) => {
// ...
});
app.listen(3000, (token) => {
if (!token) {
console.warn("port already in use");
}
}); As written in the Readme: The HTTP server and server-side websockets are based on uWebSockets. So, is there any way to port this to the capabilities of bun? P.S. Socket.io article |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
This is the main thing stopping me from using Bun at the moment, would love to see it. |
Beta Was this translation helpful? Give feedback.
-
Does socket.io work with Bun if you use the default |
Beta Was this translation helpful? Give feedback.
socket.io does work with the default
ws
and internallyws
in Bun actually uses uWebSockets so there's no need to use the uWebSockets backend (even if the uWebSockets.js backend did work in Bun, which it does not)