#61 start of map store/retrieve, communication channel using websockets

This commit is contained in:
Danielv123 committed 2017-11-21 11:06:57 +01:00
1 parent 2bcacb2513
commit 7ece1af073
9 files changed
+422 -4

No files matched your search

+14 -1
View File
@@ -603,8 +603,21 @@ app.get("/api/getFactorioLocale", function(req,res){
getFactorioLocale.asObject(config.factorioDirectory, "en", (err, factorioLocale) => res.send(factorioLocale));
});
var server = app.listen(config.masterPort || 8080, function () {
var server = require("http").Server(app);
server.listen(config.masterPort || 8080, function () {
console.log("Listening on port %s...", server.address().port);
});
/* Websockets for remoteMap */
var io = require("socket.io")(server);
var slaveMappers = {};
io.on('connection', function (socket) {
socket.emit('hello', { hello: 'world' });
socket.on('registerSlaveMapper', function (data) {
console.log(data);
slaveMappers[data.instanceID].getChunk = function getChunk(x,y){
}
});
});
module.exports = app;