Jump to content

Lobby room back end - best approaches on implementation?


Garko
 Share

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!

 

 

Link to comment
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 socket.io, will gracefully fall back to long polling for you, for those handful of users stuck on an old browser that doesn't like websockets.

 

Link to comment
Share on other sites

  • 3 weeks later...

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..

Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...