Check out http://colyseus.io/docs/api-timing-events/
You could set up a callback when it becomes the player's turn. They return a "Delayed" object which you can "cancel" if the player did perform his action in time.
Best posts made by plyoung
Check the docs, http://colyseus.io/docs/api-room/#disconnect
As for tracking who created it you could simply keep a variable in the room class which, if not set, you set it to the client.sessionId
of the joining client in onJoin
. Of course if your variable is already set you know that this is the 2nd joining player and should not use its session id.
I don't known why we must to pass roomName = "battle" as parameter to method client.GetAvailableRooms () . Why its not empty ?
That identifies what kind of room you want to information about since you can have more than one type of room on the server. You might have "chat" room, or "battle" room, or "2vs2" room, "4vs4" room, "whatever" room, etc.
On server side you did something like this. See that 1st name "game" in my case, is a room name. You can have more than one of these statements in the server. gameServer.register("game", GameRoom);
client.getAvailableRooms() or setMetadata(...) anywhere ?
setMetadata is done on the server side, in your room class.
@endel I do not see getAvialabeRooms on client side API either. (Unity)All the room list related code is commented out in Client.cs
oh, I see.. Use "in" rather than "of".
It looks much better now. Thanks.