-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Description
Describe the bug
Client getting disconnected when running socketio with bun.
The client is able to create the initial connection but after that, the client gets auto disconnect.
I have tried the same with postman using socketio connection.
This happens only when I am running my server using bun, when using node runtime, I am not facing any issue.
Bun version: 1.0.0
Node version: v20.10.0
To Reproduce
Socket.IO server version: 4.8.1
Server
import express from "express"
import { Server as SocketServer } from "socket.io"
import cors from "cors"
import http from "http"
import dotenv from "dotenv"
dotenv.config()
const app = express()
const server = http.createServer(app)
app.use(cors())
const io = new SocketServer(server, {
cors: {
origin: "*",
methods: ["GET", "POST"]
}
})
io.on("connection", (socket) => {
console.log(`User connected: ${socket.id}`)
socket.on("process-video", (data) => {
console.log(data)
})
socket.on("disconnect", (data) => {
console.log("client got disconnected")
})
})
server.listen(5001, () => {
console.log("server is running on port 5001")
})
Socket.IO client version: 4.8.1
Client
import { io } from "socket.io-client";
const socket = io("ws://localhost:5001/", {});
socket.on("connect", () => {
console.log(`connect ${socket.id}`);
});
socket.on("disconnect", () => {
console.log("disconnect");
});
Expected behavior
Client getting disconnected when running socketio with bun.
The client is able to create the initial connection but after that, the client gets auto disconnect.
I have tried the same with postman using socketio connection.
This happens only when I am running my server using bun, when using node runtime, I am not facing any issue.
Bun version: 1.0.0
Node version: v20.10.0
Platform:
- Device: [Macbook pro M1X]
- OS: [MacOS]