comparison rlgwebd.js @ 101:e59d68082664

RLG-Web: Complete the WebSocket watcher. Watching via WebSockets now takes into account terminal size, player name, etc.
author John "Elwin" Edwards <elwin@sdf.org>
date Fri, 13 Jul 2012 08:39:39 -0700
parents 3dbfdaf62623
children f34a286c51bd
comparison
equal deleted inserted replaced
100:3dbfdaf62623 101:e59d68082664
388 conn.on('close', function(code, desc) { 388 conn.on('close', function(code, desc) {
389 session.removeListener('data', dataH); 389 session.removeListener('data', dataH);
390 session.removeListener('exit', exitH); 390 session.removeListener('exit', exitH);
391 tslog("A WebSocket watcher has left game %d", session.sessid); 391 tslog("A WebSocket watcher has left game %d", session.sessid);
392 }); 392 });
393 conn.sendUTF(JSON.stringify({
394 "t": "w", "w": session.w, "h": session.h,
395 "p": session.pname, "g": session.game.uname
396 }));
393 conn.sendUTF(JSON.stringify({"t": "d", 397 conn.sendUTF(JSON.stringify({"t": "d",
394 "d": session.framebuf.toString("hex", 0, session.frameoff)})); 398 "d": session.framebuf.toString("hex", 0, session.frameoff)}));
395 } 399 }
396 400
397 /* Some functions which check whether a player is currently playing or 401 /* Some functions which check whether a player is currently playing or