SHARE
TWEET

Untitled

a guest Jan 12th, 2017 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var static = require('node-static');
  2. var http = require('http');
  3. var file = new(static.Server)();
  4. var app = http.createServer(function (req, res) {
  5.     file.serve(req, res);
  6. }).listen(1234);
  7.  
  8. var io = require('socket.io').listen(app);
  9.  
  10. io.sockets.on('connection', function (socket) {
  11.     socket.on('room', function (room ) {
  12.  
  13.     socket.room = room;
  14.     socket.join(socket.room);
  15.  
  16.     socket.broadcast.to(socket.room).emit('room', room);
  17. });
RAW Paste Data
Top