}
case "connect":
case "gconnect":
-console.log(data.code + " " + data.from);
this.$set(this.people, data.from, {name:"", id:0, gamer:data.code[0]=='g'});
this.st.conn.send(JSON.stringify({code:"askidentity", target:data.from}));
if (data.code == "connect")
break;
case "disconnect":
case "pdisconnect":
-console.log(data.code + " " + data.from);
this.$delete(this.people, data.from);
if (data.code == "disconnect")
{
switch (obj.code)
{
case "connect":
- notifyRoom(query["page"], "connect"); //Hall or Game
- if (query["page"].indexOf("/game/") >= 0)
+ {
+ const curPage = clients[sid].page;
+ notifyRoom(curPage, "connect"); //Hall or Game
+ if (curPage.indexOf("/game/") >= 0)
notifyRoom("/", "gconnect"); //notify main hall
break;
+ }
case "pollclients":
{
const curPage = clients[sid].page;
break;
case "pagechange":
// page change clients[sid].page --> obj.page
-console.log(sid + " : page change: " + clients[sid].page + " --> " + obj.page);
notifyRoom(clients[sid].page, "disconnect");
if (clients[sid].page.indexOf("/game/") >= 0)
notifyRoom("/", "gdisconnect");