# HG changeset patch # User John "Elwin" Edwards # Date 1342409433 25200 # Node ID 67b393f10c2b524a0969bc15dbc4a7b9dad55e39 # Parent 86a458080e80953bb288e2c5d6ccf8c2dc71e818 RLG-Web: improve taking over sessions. WebSocket sessions should not be taken over, and polling sessions are not yet convertible to WebSockets. Eventually the current method of taking over via Player#reset() should be replaced with autosaving the game, which will always work. diff -r 86a458080e80 -r 67b393f10c2b rlgterm.js --- a/rlgterm.js Sun Jul 15 18:18:53 2012 -0700 +++ b/rlgterm.js Sun Jul 15 20:30:33 2012 -0700 @@ -417,6 +417,10 @@ else break; } + if (!WebSocket) { + message("Your browser does not support WebSockets. You can still play, " + + "but it will be slower, and may not work in the future.", "warn"); + } return; } @@ -692,8 +696,14 @@ message("The server forgot about you, please log in again.", "warn"); } else if (reply.c == 4) { - message("You can't play that game because it is currently being " + - "played over SSH.", "warn"); + if (reply.s == "dgamelaunch") { + message("You are already playing " + game.name + " over SSH.", + "warn"); + } + else { + message("You are already playing " + game.name + + " in another browser window.", "warn"); + } } else if (reply.c == 7) { message("The game is being saved, try again in a few seconds."); diff -r 86a458080e80 -r 67b393f10c2b rlgwebd.js --- a/rlgwebd.js Sun Jul 15 18:18:53 2012 -0700 +++ b/rlgwebd.js Sun Jul 15 20:30:33 2012 -0700 @@ -756,7 +756,7 @@ var nodematch = new RegExp("^" + username + ":node:"); if (fname && (fname.match(nodematch) === null)) { /* It's being played in dgamelaunch. */ - sendError(res, 4, null); + sendError(res, 4, "dgamelaunch"); tslog("%s is already playing %s", username, gname); return; } @@ -786,7 +786,9 @@ return; } } - sendError(res, 7); + /* If there's no player, it's a WebSocket game, and shouldn't be + * seized. */ + sendError(res, 4, "WebSocket"); } else { new Player(gname, lkey, dims, respondlaunch);