summaryrefslogtreecommitdiff
path: root/interactor
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-10-23 19:14:18 +0200
committertomsmeding <hallo@tomsmeding.nl>2015-10-23 19:14:18 +0200
commitfdef017b4966dcb26020555b0dc2afc1b573fc4a (patch)
tree981f178686fc13a0b62d18f6b9cff8a8b1c016d0 /interactor
parent51bf3a48efb1b4109507bb7aaba15dd62f8b1c0f (diff)
Fix logging and disable pinging
Diffstat (limited to 'interactor')
-rw-r--r--interactor/index.html3
-rwxr-xr-xinteractor/interactor.js7
-rw-r--r--interactor/package.json1
3 files changed, 6 insertions, 5 deletions
diff --git a/interactor/index.html b/interactor/index.html
index 19dc703..4593974 100644
--- a/interactor/index.html
+++ b/interactor/index.html
@@ -11,9 +11,6 @@ var CVSH=500;
var COLOURS=["#00F","#F00","#0CC"];
var socket=io();
-setInterval(function(){
- socket.emit("ping");
-},1000);
var CELLSZ=~~(CVSH/(H+1));
var CVSW=CELLSZ*(W+1);
var CELL0X=~~(CVSW/2-W/2*CELLSZ)+.5,CELL0Y=~~(CVSH/2-H/2*CELLSZ)+.5;
diff --git a/interactor/interactor.js b/interactor/interactor.js
index c31b93f..e68e834 100755
--- a/interactor/interactor.js
+++ b/interactor/interactor.js
@@ -14,7 +14,8 @@ var app=require("express")(),
http=require("http").Server(app),
io=require("socket.io")(http),
fs=require("fs"),
- spawn=require("child_process").spawn;
+ spawn=require("child_process").spawn,
+ mkdirp=require("mkdirp");
eval(String(fs.readFileSync("common.js")));
@@ -66,6 +67,8 @@ function stopproc(proc){
});
}
+mkdirp("logs");
+
io.on("connection",function(conn){
var id=uniqid();
console.log("New IO connection id "+id);
@@ -82,7 +85,7 @@ io.on("connection",function(conn){
("00"+now.getDate()).slice(-2)+"-"+
("00"+now.getHours()).slice(-2)+
("00"+now.getMinutes()).slice(-2)+
- ("00"+now.getSeconds()).slice(-2),
+ ("00"+now.getSeconds()).slice(-2)+".txt",
"w");
var log=function(s){
fs.writeSync(logfile,s+"\n");
diff --git a/interactor/package.json b/interactor/package.json
index 38f7446..1b3cd44 100644
--- a/interactor/package.json
+++ b/interactor/package.json
@@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"express": "^4.13.3",
+ "mkdirp": "^0.5.1",
"socket.io": "^1.3.7"
}
}