repl.it
@jajoosam/

chat-server

Express

Socket.io server for chat

fork
loading
Files
  • index.js
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var express = require('express');
var app = express();

var http = require('http').Server(app);
var io = require('socket.io')(http);


io.on('connection', function (socket) {
	socket.on('message', function(data) {
		io.emit("msg", data);
	});
});


http.listen(3000, function() {
  console.log('listening on 3000');
});