summaryrefslogtreecommitdiffstats
path: root/index.js
blob: 3e06e9a815f9f82a3b928ccd9e9d0a9662fbac46 (plain)
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
30
31
32
33
34
35
36
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

var que = []

app.get('/', function(req, res){
  res.sendFile(__dirname + '/index.html');
});
app.get('/client.js', function(req, res){
  res.sendFile(__dirname + '/client.js');
});
app.get('/adm', function(req, res){
  res.sendFile(__dirname + '/adm.html');
});

io.on('connection', function(socket){
  socket.emit("quedata",que);
   
  socket.on("queadd",function(data){
		console.log("adding new que entry");
  	que.push(data);
		io.emit("quedata",que);
  });
	socket.on("quepopfirst",function(data){
		console.log("deleting first from que");
  	que.shift();
		io.emit("quedata",que);
  });


});

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