Fishnet WebGL
This guide will help you use FishNet's Websocket Transport, Bayou, and create a headless server on Edgegap for a Unity project.
You can find the final sample project on our GitHub, under the Fishnet_v4.1.6R_WebGL folder. This guide should work with any version of Fishnet, so long as you use the appropriate version of Bayou for it.
Unity requirements
This project is tested on Unity version 2021.3.16f1. You will need the following modules to be installed with it:
WebGL Build Support;
Linux Dedicated Server Build Support;
Linux Build Support (IL2CPP).
Switch the transport
Download the Unity package for Bayou on this GitHub. Import the package in the game project with the toolbar under Asset/Import Package/Custom Package....
Open the MainMenu scene located under Assets/SpaceEdge/Scenes. In the NetworkManager gameObject, remove the Tugboat transport component. Replace it with the Bayou transport, located under Asstes/FishNet/Plugins/Bayou. Take note of the port value that's set, in this case 7770.
Make sure to enable the Start On Headless option for the server build.

Build the game server & Containerizing
Open the Edgegap plugin with the Edgegap/Edgegap Hosting toolbar menu. Verify your Edgegap API Token and either create or load an application for the game. Make sure the port value matches that of the Bayou transport. Select the WS protocol, then enter a New Version Tag.
Once this is properly set up, click on Build and Push, which will automatically containerize your game server and create a new application version on the Edgegap dashboard after a short waiting period.
Testing the client
In the editor
Back in the project, select the MatchmakingSystem gameObject and change the following fields:

AppName: Set it to the “Application name” you used with the Edgegap plugin.
AppVersion: Set it to the “Version name” you used with the Edgegap plugin.
AuthHeaderValue: Set it to your Edgegap API token that you used with the Edgegap plugin.
Open the MatchmakingSystem script, located under Assets/SpaceEdge/Scripts/Systems, where you may also update those same values. Search for "UDP_PORT" and replace it with "Game Port".


Make sure that you uncheck the Start On Headless option in the NetworkManager gameObject as well.
Once this is done, click Play in the editor, then enter a name in the text box and click on Start Game. The game will check for any available server, or automatically have one get deployed if none exist, before connecting to it.
If there is a ConnectionFailed error on the client side, it may be because the Start On Headless option was not enabled in the server build, which means the deployment is not in a state to accept connections since the server never properly started. Make sure the option is enabled before trying again by creating a new container image and app version.
It may also be because app version's port name is not the same as in the MatchmakingSystem script. Make sure that both have the same name, in this case "Game Port", before trying again.
On Itch.io
Once you've confirmed the game client works in the editor, it should also work in Itch.io. To upload your game there, you will need to make a client build in the Build screen of the Unity Editor, under File -> Build Settings. Select the following options:
Set
PlatformtoWebGL;Open up the
Player Settings. UnderPlayer -> Publishing Settings, set theCompression FormattoGzipand make sure theDecompression Fallbackoption is selected. Save these settings, and close the window.

Then press build and select a new empty folder named build as the file destination. Compress the files of this build folder into a zip folder, making sure that they are at the root of it. Then you simply need to upload the zip folder to your Itch project, and make sure to select the option for the file to play in the browser. The game should then work the same way as in the editor.
Last updated
Was this helpful?

