I\'m using Socket.io, and I\'d like to know the status of connection to the server from the client-side.
Something like this:
socket.status // return
These days, socket.on('connect', ...) is not working for me. I use the below code to check at 1st connecting.
if (socket.connected) console.log('socket.io is connected.')
and use this code when reconnected.
socket.on('reconnect', ()=>{ //Your Code Here });