Garko Posted June 2, 2019 Share Posted June 2, 2019 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! Quote Link to comment Share on other sites More sharing options...
mattstyles Posted June 4, 2019 Share Posted June 4, 2019 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. Quote Link to comment Share on other sites More sharing options...
WombatTurkey Posted June 22, 2019 Share Posted June 22, 2019 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.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.