- this.conn.onopen = () => {
- this.conn.send(JSON.stringify({
- code:"ping",oppid:this.oppid,gameId:this.gameRef.id}));
- };
+ this.gameRef.id = this.$route.params["id"];
+ this.gameRef.rid = this.$route.query["rid"];
+ this.launchGame();
+ }
+ // Poll all players except me (if I'm playing) to know online status.
+ // --> Send ping to server (answer pong if players[s] are connected)
+ if (!!this.gameRef.id)
+ {
+ this.players.forEach(p => {
+ if (p.sid != this.st.user.sid)
+ this.st.conn.send(JSON.stringify({code:"ping", oppid:p.sid}));
+ });