I'm trying to use socket.io for my react/flask project and every time I require socket.io in my app.js file, node fails to compile and I get this message.
Failed to compile.
./node_modules/engine.io/lib/server.js
Module not found: Can't resolve 'uws' in 'C:\Users\Walker\Desktop\xxxxx\xxxxx\node_modules\engine.io\lib'
I've tried manually installing uws with node, but nothing changes. I also used create-react-app on another computer and installed socket.io but I'm getting the same error. I followed many 'Getting Started' articles but I'm continuously getting the same error. Anyone know what could be wrong?
Error − An error event is sent from the server. Message − When the server sends a message using the send function. Reconnect − When reconnection to the server is successful. Reconnecting − When the client is in the process of connecting.
Try using socket.io-client
Here is the code:
import openSocket from 'socket.io-client';
const socket = openSocket(myURL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With