From fdef017b4966dcb26020555b0dc2afc1b573fc4a Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 23 Oct 2015 19:14:18 +0200 Subject: Fix logging and disable pinging --- interactor/index.html | 3 --- interactor/interactor.js | 7 +++++-- interactor/package.json | 1 + 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" } } -- cgit v1.2.3-70-g09d2