node.js /socket.io/socket.io.js not found

Copying socket.io.js to a public folder (something as resources/js/socket.io.js) is not the proper way to do it. If Socket.io server listens properly to your HTTP server, it will automatically serve the client file to via http://localhost:<port>/socket.io/socket.io.js, you don’t need to find it or copy in a publicly accessible folder as resources/js/socket.io.js & serve it manually. … Read more

socket.io – how to broadcast messages on a namespace?

Seems I was able to solve this for myself after opening a bounty. Sorry about that. Anyway, see if this helps: chat.on(‘connection’, function (socket) { socket.on(‘message’, function (msg) { socket.emit(msg); // Send message to sender socket.broadcast.emit(msg); // Send message to everyone BUT sender }); }); However, you could save some bandwidth and create a more … Read more

How to reconnect to websocket after close connection [duplicate]

When the server closes the connection, the client does not try to reconnect. With some JS frameworks maybe, but the question was, at the time of this answer, tagged as plain Vanilla JS. I’m a bit frustrated because the accepted, upvoted answer is plainly wrong, and it cost me some additional time while finding the … Read more