Easy WebGL Hosting with PlayFlow
How PlayFlow Makes WebGL Hosting Easy
For seamless WebGL gaming experiences in web browsers, secure WebSocket connections are crucial, but configuring them can be complex. Often, developers end up managing certificates and networking issues, which can be time-consuming. With PlayFlow, however, you only need to enable a simple option to handle these concerns effortlessly.Mirror with SimpleWebTransport provides robust WebSocket support for WebGL builds, making it easy to deploy multiplayer games to web browsers.
Before We Begin
This tutorial assumes you’ve already completed the standard Mirror setup. In the following steps, we’ll convert your project to support WebGL.
Setup Steps
1
Install SimpleWebTransport
Mirror comes with SimpleWebTransport included by default. If you don’t have it:
- Ensure you have the latest version of Mirror
- SimpleWebTransport should be in your project automatically
SimpleWebTransport is Mirror’s official WebSocket transport for WebGL builds.
2
Add SimpleWebTransport to NetworkManager
- Select your NetworkManager in the scene
- Add the SimpleWebTransport component to it
-
Remove or disable KCP Transport (not needed for WebGL)
3
Configure SimpleWebTransport
In the SimpleWebTransport component:Client settings:
- Enable “Client Use Wss” ✓ (WebSocket Secure)
- Set Client Port Option to “Use Custom Port”
- Set Client Port to match your PlayFlow external port (you’ll get this later)
- Keep Port as
7778
(default)
The “Client Use Wss” option is critical for secure WebGL connections through PlayFlow.
4
Configure NetworkManager
Ensure Auto Start Server Build is checked in your NetworkManager - this will automatically start the server in headless builds.
5
Build Your PlayFlow Server
Open the PlayFlow Cloud window from Unity toolbar (PlayFlow → PlayFlow Cloud).Click Upload Server to build and upload your Unity server.
PlayFlow automatically builds a headless Linux server optimized for dedicated hosting.
6
Configure PlayFlow Port Protocol
In the PlayFlow dashboard:
- Navigate to Configuration tab
- Add a new port or edit existing
- Port Name:
mirror_webgl
- Port Number:
7778
(SimpleWebTransport default) - Protocol: TCP
- Enable TLS ✓ (Critical for WebGL)
- Save configuration
Why TCP + TLS? WebGL requires secure WebSocket connections. PlayFlow handles the SSL certificates automatically when you enable TLS.
7
Start a PlayFlow Server
- Go to the Servers tab in PlayFlow
- Click Create Server
- Select your uploaded build
- Choose your configuration
- Launch the server
8
Configure Your Client
- Click on your server instance’s Details
- Look for the TLS Connection information
- In Unity, configure your client:
- Set Network Address to the TLS hostname (e.g.,
connect.playflowcloud.com
)
- Set Client Port to the External Port from PlayFlow
- Ensure Client Use Wss is checked ✓
- Ensure Client Port Option is set to Use Custom Port
Important: For TLS/WSS connections, use the hostname (like
connect.playflowcloud.com
) not the IP address. PlayFlow provides this in the server details.9
Build Your WebGL Client
- In Unity, switch to WebGL platform in Build Settings
- Build your game
- Zip the built files
- Upload to your chosen hosting platform (e.g., itch.io, GitHub Pages, PlayFlow’s built-in hosting)
Popular WebGL hosting options include itch.io, GitHub Pages, and PlayFlow’s integrated WebGL deployment.
Success!
Just like that, you’ve created a server and have your clients in the web browser securely connecting to it!Troubleshooting
Connection Failed
Connection Failed
- Verify TLS is enabled in PlayFlow port settings
- Check that “Client Use Wss” is enabled in SimpleWebTransport
- Ensure “Client Port Option” is set to “Use Custom Port”
- Verify client is using the TLS hostname (not IP address)
- Confirm the correct external port is configured
Multiple Transports Issue
Multiple Transports Issue
If you have both KCP and SimpleWebTransport on your NetworkManager, make sure only SimpleWebTransport is active for WebGL builds. You can use platform-specific code to switch transports.
SSL/TLS Configuration
SSL/TLS Configuration
Don’t modify the SSL settings in SimpleWebTransport - PlayFlow handles all certificates automatically when TLS is enabled in the port configuration.
Port Mismatch
Port Mismatch
Remember that the server listens on the port you set in SimpleWebTransport (default 7778), but clients connect through PlayFlow’s external port. Always use the external port for client connections.
Resources
- PlayFlow Documentation: documentation.playflowcloud.com
- PlayFlow Discord: discord.gg/P5w45Vx5Q8
- Mirror Documentation: mirror-networking.gitbook.io
- Mirror Discord: discord.gg/mirror