Slide 21
Slide 21 text
Socket.io и Nordstream
var http = require('http'),
io = require('socket.io')
server = http.createServer(function(req, res){
res.writeHeader(200, {'Content-Type': 'text/html'});
res.writeBody('
Hello world
');
res.finish();
});
// socket.io
var socket = io.listen(server);
socket.on('connection', function(client){
// new client is here!
client.on('message', function(){ … })
client.on('disconnect', function(){ … })
});