projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor models (merge Players in Games), add cursor to correspondance games. Finishe...
[vchess.git]
/
server
/
sockets.js
diff --git
a/server/sockets.js
b/server/sockets.js
index
d96b696
..
7de7abb
100644
(file)
--- a/
server/sockets.js
+++ b/
server/sockets.js
@@
-165,7
+165,7
@@
module.exports = function(wss) {
// but the requested resource can be from any tmpId (except current!)
case "askidentity":
case "asklastate":
// but the requested resource can be from any tmpId (except current!)
case "askidentity":
case "asklastate":
- case "askchallenge":
+ case "askchallenge
s
":
case "askgame":
case "askfullgame": {
const pg = obj.page || page; //required for askidentity and askgame
case "askgame":
case "askfullgame": {
const pg = obj.page || page; //required for askidentity and askgame
@@
-201,23
+201,20
@@
module.exports = function(wss) {
// Notify all room: mostly game events
case "newchat":
case "newchallenge":
// Notify all room: mostly game events
case "newchat":
case "newchallenge":
- case "deletechallenge":
+ case "deletechallenge
_s
":
case "newgame":
case "resign":
case "abort":
case "drawoffer":
case "rematchoffer":
case "draw":
case "newgame":
case "resign":
case "abort":
case "drawoffer":
case "rematchoffer":
case "draw":
- if (!!obj.oppsid)
- // "newgame" message from Hall: do not target players
- notifyAllBut(page, "newgame", {data: obj.data}, [sid, obj.oppsid]);
- else notifyRoom(page, obj.code, {data: obj.data});
+ notifyRoom(page, obj.code, {data: obj.data});
break;
case "rnewgame":
break;
case "rnewgame":
- // A rematch game started: players are already informed
+ // A rematch game started:
+ // NOTE: no need to explicitely notify Hall: the game will be sent
notifyAllBut(page, "newgame", {data: obj.data}, [sid]);
notifyAllBut(page, "newgame", {data: obj.data}, [sid]);
- notifyAllBut("/", "newgame", {data: obj.data}, [sid, obj.oppsid]);
notifyRoom("/mygames", "newgame", {data: obj.data});
break;
notifyRoom("/mygames", "newgame", {data: obj.data});
break;
@@
-272,7
+269,7
@@
module.exports = function(wss) {
case "notifynewgame":
if (!!clients["/mygames"]) {
obj.targets.forEach(t => {
case "notifynewgame":
if (!!clients["/mygames"]) {
obj.targets.forEach(t => {
- const k = t.sid || idToSid[t.
u
id];
+ const k = t.sid || idToSid[t.id];
if (!!clients["/mygames"][k]) {
Object.keys(clients["/mygames"][k]).forEach(x => {
send(
if (!!clients["/mygames"][k]) {
Object.keys(clients["/mygames"][k]).forEach(x => {
send(
@@
-297,7
+294,7
@@
module.exports = function(wss) {
// Passing, relaying something: from isn't needed,
// but target is fully identified (sid + tmpId)
// Passing, relaying something: from isn't needed,
// but target is fully identified (sid + tmpId)
- case "challenge":
+ case "challenge
s
":
case "fullgame":
case "game":
case "identity":
case "fullgame":
case "game":
case "identity":