Client debugging ... Leaving both current and joining room with just one room.leave() call ....
HTML5 works well, Windows is doing well most of the time, but Mac and Android are having troubles in leaving and joining. I suspect that Windows problems are caused by the same issue, but couldn't steadily reproduce that.
It is the same HaXe client-code due to being a HaXe extension.
There are only differences in Player Name gathering on HTML versus native. Didn't test iOS/Linux.
What I think is happening is that room.leave() is done twice on Mac/Android?!?
What can be the cause of this?!
HTML5 debug:
Colyseus.hx:156: JoinRoom to joinID: BWNT-kGd0 Calling Room Leave with room.id: NRL_w4txR
Colyseus.hx:421: leavecounter: 1 room.onLeave RoomID: NRL_w4txR Session ID: XqE4dF-s6
Colyseus.hx:275: (Client: )p6_HgFPtE join room to JoinID : BWNT-kGd0
Good:
Colyseus.hx:304: joinRoom : joinCounter: 2 Joined Room BWNT-kGd0 sessionID : VXeeGm4oI
Debug Mac:
Colyseus.hx:156: JoinRoom to joinID: z40eavIgr Calling Room Leave with room.id: Ge_RICPir
Colyseus.hx:421: leavecounter: 1 room.onLeave RoomID: Ge_RICPir Session ID: f2c1YeU3i
Colyseus.hx:275: (Client: )9EoXglrY9 join room to JoinID : z40eavIgr
Colyseus.hx:421: leavecounter: 2 room.onLeave RoomID: z40eavIgr Session ID: null
Never reached joinRoom!!
And it does TWO leave rooms !!!
The output on server side is the same (of course not the IDs and names ...)
HTML5
Request join : this.roomId: NRL_w4txR options.Type: undefined PlayerName: APlayer3642 OldMax: 1
Number of clients in room: 1 the room id is : NRL_w4txR
Request join : this.roomId: NRL_w4txR options.Type: undefined PlayerName: APlayer7523 OldMax: 100
Request join : this.roomId: NRL_w4txR options.Type: undefined PlayerName: APlayer7523 OldMax: 100
StateHandlerRoom created! { PlayerName: 'APlayer7523',
RoomName: 'Room5672',
requestId: 2,
clientId: '3VTAK8HPh',
lobby: { rooms: [] } }
Request join : this.roomId: BWNT-kGd0 options.Type: undefined PlayerName: APlayer7523 OldMax: 1
Number of clients in room: 1 the room id is : BWNT-kGd0
Number of clients in room: 0 the room id is : NRL_w4txR
Dispose StateHandlerRoom : remove room.id : NRL_w4txR
Request join : this.roomId: BWNT-kGd0 options.Type: JOIN PlayerName: APlayer3642 OldMax: 100
Number of clients in room: 2 the room id is : BWNT-kGd0
Number of clients in room: 1 the room id is : BWNT-kGd0
MAC:
Request join : this.roomId: Ge_RICPir options.Type: undefined PlayerName: APlayer7255 OldMax: 1
Number of clients in room: 1 the room id is : Ge_RICPir
Request join : this.roomId: Ge_RICPir options.Type: undefined PlayerName: Player5710 OldMax: 100
Request join : this.roomId: Ge_RICPir options.Type: undefined PlayerName: Player5710 OldMax: 100
StateHandlerRoom created! { PlayerName: 'Player5710',
RoomName: 'Room1021',
requestId: 4,
clientId: 'vJGYZCiJ5',
lobby: { rooms: [] } }
Request join : this.roomId: z40eavIgr options.Type: undefined PlayerName: Player5710 OldMax: 1
Number of clients in room: 1 the room id is : z40eavIgr
Number of clients in room: 0 the room id is : Ge_RICPir
Dispose StateHandlerRoom : remove room.id : Ge_RICPir
Request join : this.roomId: z40eavIgr options.Type: JOIN PlayerName: APlayer7255 OldMax: 100
Number of clients in room: 2 the room id is : z40eavIgr
Number of clients in room: 1 the room id is : z40eavIgr
I even used a timer to call join after the leave so that it does it 5 or 10 seconds later.
As soon as I do the join the leave call is executed !!!