question

Jake L avatar image
Jake L asked

Best way to handle secure websocket servers for a browser game?

Hey all. My team is working on a PlayFab implementation of multiplayer servers for a browser based game. Our main requirements were allowing connections over wss, and ideally keeping all the traffic using the standard http/https ports. We have a working proof of concept, but wanted to get feedback on whether this is the best way to do it.

  • We have a C# game server deployed to PlayFab multiplayer servers that accepts and manages websocket connections.
  • Clients connect to these through NGINX instances running in an Azure VM Scale Set which reverse proxy to a given PlayFab DNS server name and port which gets passed in via the url path. Thus allowing users to use a single URL and port to connect to any PlayFab server/port.
  • Clients connect to the NGINX servers through Azure Application Gateways which adds SSL termination, upgrading the requests to SSL and allowing the wss protocol.

Obviously this adds some extra complexity in that we also need to manage auto-scaling of the proxy servers, as well as needing to deploying a proxy server cluster in each region we run game servers (thankfully the added cost isn't a real concern for us), but just wanted to see if anyone who has used PlayFab for longer than the 3 days I have had any more insight into this type of use case. Thanks!

multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

PlayFab Multiplayer Server 2.0 is not designed for long-time running, while session-based games are more suitable. Your current solution looks fine for me. Hopefully there are developers in the community can join this discussion and share their experiences.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jake L avatar image Jake L commented ·

Yes to clarify these are game room/server sessions running on playfab and communicating with players via websockets, so it is a session-based game.

The actual website/assets/whatnot are being served from actual webservers and CDNs.

We just wanted a good solution for session allocation/management and autoscaling and playfab seemed like the perfect fit, even if websockets isn't the usual use-case for it.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Jake L commented ·

PlayFab Multiplayer servers is powered by Azure Cloud with Docker. You are able to design your own customized server build, and websocket is supported. As you have seen, certificate is supported and can be uploaded when configuring the server build.

Both auto-allocation and auto-scaling are supported. If using matchmaking system, when a ticket is matched, PlayFab will allocate a server (turns from stand by state to active state) and Players are able to call GetMatch API to get IP/port of this server instance. We also have standby feature and dynamic standby features to help modify the capability of your server build to handle peak periods while save the cost when the off-peak hours. Please check the following document.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.