how to emit socket.io code example
Example: socket emit to specific room using nodejs socket.io
io.on('connection', socket => { socket.on('disconnecting', () => { const rooms = Object.keys(socket.rooms); // the rooms array contains at least the socket ID }); socket.on('disconnect', () => { // socket.rooms === {} });});