DEV Community

Discussion on: Buiding Chat App with React Native and Socket.io

Collapse
 
mustafakameldev profile image
mustafakameldev

I have an issue with it const io = require("socket.io").listen(server)
so I changed to const io = require("socket.io")(4000).listen(server);
and it didn't work too,
Please Help me to fix this issue .

Collapse
 
artie profile image
Cyrus Rohail

Hi, I searched about this bug since I had the same problem and I found out that 'require("socket.io")' returns a socket.io Server class. So you can just do const io = require("socket.io")(Port || ExistingHttpServer); and it should work