-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
23 lines (21 loc) · 943 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const net = require('net');
const Client = require('./Client.js');
const LogLib = require("./Log.js");
var Log = new LogLib.Log("index.js", "index.js");
const SettingsManager = require("./settingsManager.js");
const SMServerAPI = require("./SMServerAPI.js");
// var AIRMESSAGE_PORT = SettingsManager.readSetting("AIRMESSAGE_PORT");
//FUTURE TODO: Integrate VNC for GamePigeon, etc
//FUTURE TODO: When texting the server, send "Remote" to get a remote control link
SMServerAPI.ensureAttachmentFoldersExist(); //A little race condition but it probably doesn't matter
SettingsManager.readSetting("AIRMESSAGE_PORT").then((port) => {
var server = net.createServer();
server.on('connection', handleConnection);
server.listen(port, function() {
Log.i('server listening to '+ JSON.stringify(server.address()));
});
var clients = [];
function handleConnection(conn) {
clients.push(new Client(conn));
}
});