5 ms·
Socket.IO also gives you things like cross-everything callbacks: // server io.emit('event', function (msg) { console.log('Client responded!', msg) })
by renekooi 11y ago
Socket.IO also gives you things like cross-everything callbacks:
// server
io.emit('event', function (msg) { console.log('Client responded!', msg) })
// client
io.on('event', function (cb) { cb('This is my response') })
And it also provides socket namespacing, and "rooms" (a bit like chat rooms), and broadcasts, and a bunch of things that I don't use.
Sure, you can bolt all of that on in probably a few hundred lines, but socket.io also doesn't just do sockets and events :)
(And it also does it in less than 61000 lines. You still need the "ws" module to do WebSocket stuff in Node, even if you don't use socket.io)