Closed ChoSeoHwan closed 1 year ago
hello I got the same error thks for your help
I wasn't able to reproduce. Does it work with an older version of uWebsocket?
@frederic117 which OS are you using? Windows 10 too?
i just try with the last version uNetworking/uWebSockets.js#v20.15.0 i'm on windows11 thanks for your quick reply :)
Same error here on a MacBook Pro with M1 Pro processor.
socket.io ^4.5.4
uWebsocket.js uNetworking/uWebSockets.js#v20.15.0
Fixed this problem on my side.
Since I already had an app running socket.io with a HTTP server, I was using this app to migrate to µWebSockets. There were two problems:
Hope it helps. ✨
import { Server } from "socket.io";
import { App } from "uWebSockets.js";
const server = (port = 3000) => {
const io = new Server()
io.attachApp(App().listen(port, () => { }))
return io
}
server()
For future readers: the code above was invalid, it's the uWebSocket server that must listen to incoming connections:
const io = new Server();
const app = App();
io.attachApp(app);
app.listen(80);
Reference: https://socket.io/docs/v4/server-initialization/#with-uwebsocketsjs
Please reopen if needed.
Fixed this problem on my side.
Since I already had an app running socket.io with a HTTP server, I was using this app to migrate to µWebSockets. There were two problems:
- I was still passing the HTTP server to the socket.io server constructor and the HTTP server was still listening on the main port – that's why the socket had no subscribe method.
- I forgot to actually trigger the listen on the µWebSockets app. 🤦🏼♂️
Hope it helps. ✨
So you separated the http server or you were able to use uws as the http server?
Describe the bug
Error occurred when use uWebSocket.
It runs successfully, but when trying to establish a connection I get the error below.
To Reproduce
Server
Socket.IO server version:
^4.5.4
uWebsocket.js version :uNetworking/uWebSockets.js#v20.15.0
Expected behavior
Should work normally with uWebsocket.
Platform:
Additional context Add any other context about the problem here.