Speed up development with full-stack environments for every branch.

Learn More

Sending and getting data [Socket.IO]

1316 Runs 6827 Views 1233 Copies
Saved

Saved

sundip 66

sundip
published 5 years ago

/**
 * More details here: http://socket.io/#how-to-use 
 */

var app = require('express')()
  , server = require('http').createServer(app)
  , io = require('socket.io').listen(server);

server.listen( 80 );

app.get('/', function (req, res) {
  res.sendfile(__dirname + '/index.html');
});

io.set('log level', 1);


io.sockets.on('connection', function (socket) {
  socket.on('ferret', function (name, fn) {
    fn('woot');
  });
});
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).