-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (20 loc) · 659 Bytes
/
app.js
File metadata and controls
29 lines (20 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var express = require('express');
var app = express(),
http = require('http'),
server = http.createServer(app),
io = require('socket.io').listen(server);
server.listen(process.env.VCAP_APP_PORT || 3001);
//app.configure(function(){
// app.use(express.bodyParser());
//});
app.use("/", express.static(__dirname + '/static'));
io.sockets.on('connection', function (socket) {
socket.emit('connection', {});
socket.on('message', function(msg){
console.log('message', msg);
socket.broadcast.emit('msg', msg);
});
socket.on('remote value', function(data) {
socket.broadcast.emit('remote', data);
});
});