Lobby room back end - best approaches on implementation?

Recommended Posts

Hi guys, my game makes use of a lobby room. After you sign in, you are redirected to a lobby room page, has any of you implemented one and can offer advice on an approach?

My approach would be something like this:

1. Server keeps track of all currently open and currently active lobby rooms (games in progress).

2. When a user clicks (host a room), server creates a room object, appends it to the collection of open rooms and automatically adds the user to the room.

3. Server pings all the users  with a list of all open lobby rooms every cca 5-10 seconds (websockets / http? ) and list refreshes on the front end.

4. Users can join any of the open lobby rooms with available slots.


Now the question is, do I use websockets or http, are there some security issues with this approach, etc... I appreciate any advice!



Share this post

Link to post
Share on other sites

Websockets will be the more elegant solution, and lets you 'push' to clients as state changes rather than 'pull'.

Most websocket implementations, such as, will gracefully fall back to long polling for you, for those handful of users stuck on an old browser that doesn't like websockets.


Share this post

Link to post
Share on other sites

I'd definitely do websockets in regards to point 3. Much faster and more lightweight to get a ping through a message instead of an entire http request. Plus, if you have hundreds of rooms, that's a lot of http requests per 5-10 seconds.

Although it could totally be done with http I guess..

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.