When you need this

Your game runs in a web browser, on a page served over https. Browsers block plain ws:// connections from an https page. They only allow wss://, the secure kind. Turn on TLS for your port and Simpl handles the encryption. Your game server does not change. If your game is not played in a browser, you don’t need this page.

Set it up

  1. Set your port to TCP. A new project starts with one UDP port. WebSocket needs TCP.
  2. Turn on TLS for that port. Open your project’s Environment tab, click Edit ports in the Ports section, and tick TLS on the port. Or click Browser / WebSocket game. It sets a TCP port named game with TLS on, listening on 8080. You can change the number. Then click Save.
  3. Listen on plain TCP in your game. Don’t add encryption to your server. Simpl does that. Read the port from SIMPL_PORT_GAME when your server starts, as described in Ports and environment.
Servers you started before you saved keep their old settings. Start a new server to try the change. With the API, set tls_enabled to true on a TCP port. See Update a project.

How to connect

Players connect to:
Use the host and external_port from your server’s details. For example, wss://iad.servers.simpl.gg:31456. The server details in the dashboard show the full address. In the API, the same values are in network_ports. Always use the host name. Never use the IP address. TLS only works with the host name.

What to expect

  • A TLS port accepts wss:// only. A plain ws:// connection to it fails.
  • If you also need plain ws://, for example to test on your own computer, add a second TCP port and leave TLS off on it.
  • Your game still sees plain TCP. It never sees the encryption.
  • TLS works on TCP ports only. A UDP port with TLS on is refused with the error TLS_REQUIRES_TCP.

If it does not connect

  • The port is still UDP. Switch it to TCP, then turn on TLS.
  • You used the IP address. Use the host name from the server’s details.
  • The page is on http and the address is ws://. A page on https can only open wss://. Use the wss:// address with the host name.
  • The server started before you saved the setting. Running servers keep the settings they started with. Start a new server.
  • You tried ws:// on a TLS port. Use wss://, or add a second TCP port without TLS.

Example: Godot 4

This is only an example. It shows the least code that works. Other engines do the same two things: listen on plain TCP on the port Simpl gives you, and connect from the browser with wss://. In your server, listen with WebSocketMultiplayerPeer. Read the port and address Simpl gives you. There is no TLS in your game.
In your browser game, connect with wss:// and the host and port from the server’s details:
A Godot web export on an https page can only connect with wss://.