Closed vincentsartoko closed 7 months ago
how to resolve this error
@Stevenzwzhai you need to redirect the request to wss instead of http, are you using VPS?
to resolve an error like that try:
httpServer.on('upgrade', wsProxy.upgrade);
and const wsProxy = app.use('/socket.io/', createProxyMiddleware({ ... }));
, it may be a port conflict like mentioned here https://github.com/parcel-bundler/parcel/discussions/7071httpServer.listen(process.env.PORT, process.env.NODE_ENV === "production" ? HOST_IP : '0.0.0.0');
For future readers:
This might indicate that something between the server and your browser is preventing the WebSocket connection.
More information here: https://socket.io/docs/v4/troubleshooting-connection-issues/#problem-the-socket-is-stuck-in-http-long-polling
Please reopen if needed.
The connection to the socket works, because here is my code (React):
Once the client receives something from the socket listener "open", it will no longer show the loading screen, but let's just put console.log for simplicity. Everything works fine, I opened another tab and I can send chat, friend requests, etc.
However, inside the console I got this error:
If you have any clue on the error please let me know thank you!