A friend and I are creating a multiplayer lobby. The deployment will consist of a single login server sitting out in front, handling all authentications, and then arbitrarily many lobby servers to manage different lobbies. The idea is that any given user can go to any lobby, like the North America West lobby, the Europe lobby, that kind of thing. The lobby servers are not located on the same LAN as the login server.
All queries against the login server are synchronous, so we just use a simple request/response protocol, with no persistent connections. Session state is managed in a way similar to how HTTP does it.
We are about to start on the lobby servers and are not sure how best to handle connections and authentication. The communication here is partly synchonous and partly asynchonous. For example, a user may request to host a game, so that would be a synchronous request. Or the lobby may indicate to the user that somebody just sent him a chat message, or that a new game is being hosted, or whatver. Asynchonous there.
We are thinking that for any given user, there should be a persistent connection to his current lobby for handling asycn communications. Synchronous requests would be sent to the lobby server in the same manner they’re sent to the login server. We would want all such requests to be authenticated.
-
Does the above seem reasonable?
-
Should different types of async communications be handled on different ports? (E.g. should incoming chats be handled on a different port than new game notifications) What are the common ports (and are which are commonly TCP-based vs. UDP-based)
-
For authenticating lobby server requests, we were thinking that on entering a lobby, the lobby would request the auth info from the login server one time and cache it so as to avoid making the lobby server query the login server with every request. Is this reasonable?
Willie