-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
31 lines (26 loc) · 892 Bytes
/
app.js
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
var http = require('http'),
fs = require('fs'),
routing = require("./src/routing"),
socketMgr = require("./src/socketManager"),
channelMgr = require("./src/channelManagement"),
io = require('socket.io')
;
// Create server
var app = http.createServer(function (request, response) {
routing.execute(request, response);
});
// Destroy obsolete channels every seconds
setInterval(function() {
channelMgr.cleaner();
}, 600000); // Check each 10 minutes
// =============== BEGIN SOCKET.IO ===============
// Listen app
io = io.listen(app, { log: false });
// Bind event on each new sockets
io.sockets.on('connection', function (socket) {
socketMgr.init(socket);
});
// =============== END SOCKET.IO ===============
// Open server on port 10000
app.listen(10000);
console.log('SMS running at http://localhost:10000/');