multiple connections react js
See original GitHub issueHi I have a problem !!!
When io connect to the server, Server log over and over: Like this: New client connected Client disconnected New client connected Client disconnected Client disconnected New client connected Client disconnected New client connected New client connected Client disconnected Client disconnected New client connected New client connected Client disconnected New client connected Client disconnected New client connected Client disconnected New client connected Client disconnected Client disconnected New client connected Client disconnected New client connected New client connected Client disconnected Client disconnected Client disconnected Client disconnected Client disconnected Client disconnected
Server Code:
io.origins('*:*');
io.on('connection', (socket) => {
console.log('New client connected');
socket.on('disconnect', () => {
console.log('Client disconnected');
});
});
Client Code:
import io from 'socket.io-client';
const socket = io.connect('http://192.168.1.34:3000');
What is wrong in my code??? Please help me
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top GitHub Comments
install socket.io-client@2.3.1
Yes @darrachequesne, I upgrading my server version to 4.1.2 after found a weird timeout on server socket.io’s debug logs and it’s work properly. 🎉 (I was at the 2.x 🤦)
Conclusion beware of your server and client socket.io versions 😅
If @skyredmilad confirm, we can close this issue.