Forum ‹ Multiplayer ‹ How to tell if a room returned from listRooms is mine?
4 posts
• Page 1 of 1
How to tell if a room returned from listRooms is mine?
I'm trying to implement a listRooms operation, and if 0 rooms are found, create one. After X seconds, remove the room I created (by disconnecting it), and search again. Problem is, I delete the room, search again, and because it's too fast, the room isn't deleted yet, and I get it back in the listRooms callback the second time around.
I'm trying to figure out if it's my own room, but I can't seem to find the roomId of my own created room, so I can't compare it to the ones found in the listRooms callback...
Is there a way of getting the roomId of the room I created (I put "null" in the createJoinRoom method)? or better yet, see if I created a certain room?
Thanks!
I'm trying to figure out if it's my own room, but I can't seem to find the roomId of my own created room, so I can't compare it to the ones found in the listRooms callback...
Is there a way of getting the roomId of the room I created (I put "null" in the createJoinRoom method)? or better yet, see if I created a certain room?
Thanks!
- trueicecold
- Posts: 11
- Joined: October 10th, 2011, 1:53 pm
Re: How to tell if a room returned from listRooms is mine?
If you call CreateRoom with a null room id, you'll get back the generated room id as a result, and you can then call JoinRoom with that id, and then get back a Connection just as if you had called CreateJoinRoom directly.
The room id is also accessible though the RoomId property in your serverside code, so you can send it out to the user in a message in the UserJoined method.
The room id is also accessible though the RoomId property in your serverside code, so you can send it out to the user in a message in the UserJoined method.
-

Henrik - .IO
- Posts: 575
- Joined: January 4th, 2010, 1:53 pm
Re: How to tell if a room returned from listRooms is mine?
Hm... so that means CreateJoinRoom can't get the roomId?
Plus, creating a room will leave a "floating" room? with no users in it? I was under the impression empty rooms are automatically closed, Was I mistaken?
Thanks a lot
Plus, creating a room will leave a "floating" room? with no users in it? I was under the impression empty rooms are automatically closed, Was I mistaken?
Thanks a lot
- trueicecold
- Posts: 11
- Joined: October 10th, 2011, 1:53 pm
Re: How to tell if a room returned from listRooms is mine?
trueicecold wrote:Plus, creating a room will leave a "floating" room? with no users in it? I was under the impression empty rooms are automatically closed, Was I mistaken?
Empty rooms are closed, but not immediately.
-

Henrik - .IO
- Posts: 575
- Joined: January 4th, 2010, 1:53 pm
4 posts
• Page 1 of 1