How to fix Node.js client connect_error:
Error: server error at Socket.onPacket (socket.io.js:1) at XHR.<anonymous> (socket.io.js:1) at XHR.Emitter.emit (socket.io.js:1) at XHR.Transport.onPacket (socket.io.js:1) at callback (socket.io.js:2) at Object.exports.decodePayload (socket.io-.js:2) at XHR.Polling.onData (socket.io.js:2) at Request.<anonymous> (socket.io-.js:2) at Request.Emitter.emit (socket.io.js:1) at Request.onData (socket.io.js:2)
Main raison is mismatched versions of socket.io in client and server. You can choose the match JS client library at: https://cdnjs.com/libraries/socket.io or use /socket.io/socket.io.js on your server eg: https://ws.tutorialspots.com:31111/socket.io/socket.io.js