Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = require('express')();
- var http = require('http').createServer(app);
- var io = require('socket.io')(http);
- app.get('/', function(req, res){
- res.sendFile(__dirname + '/chat.html');
- });
- io.on('connection', function(socket){
- socket.on('chat message', function(msg){
- io.emit('chat message', msg);
- });
- });
- http.listen(3000, function(){
- console.log('listening on *:3000');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement