Issue with Web multiplayer

Godot Version

Godot 3.5.1-stable


Hi, i have made a code to get LAN multiplayer on web. And it works great on the windows export. However, in the HTML5 export, it fails when trying to host and join. Could you please help me identify the issue ?

Here you have the 2 scripts that handle hosting and joining:
Main Script: Main Script -
WebNetwork Script: WebNetwork Script -

Thank you in advance for your help.

Does the browser devtools console show any errors? Chrome shortcut to open F12

It show this error (i replace the ip adress by “x”):
Mixed Content: The page at ‘’ was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint ‘ws://’. This request has been blocked; this endpoint must be available over WSS.

That explains it :smile: You need to host the server on a server with ssl. This means you need a domain name, which cost about 10 bucks a year. Most domain providers worth their salt provide ssl for free. Cloudflare is my go-to but it doesn’t really matter which one you pick.

Or you can host the game elsewhere without ssl (as in http instead of https host for game client)

Ah ok, thanks, but the goal was to connect a tablet to a pc using web app. So using a server with a domain name etc is not ideal. I really want the user to be able to host on his pc by pressing a button.


Or you can host the game elsewhere without ssl (as in http instead of https host for game client)

How do i do that ? Every website i know is https, and hosting the game on a custom website seem overcomplicated for my use case.

I’m not aware of a way other than a custom website if you want to run it on browser

Ok, thanks for your help.
I did some researches and it seem that if i get a SSL Certificate and load it into the server when it get hosted by the user, it will make the hosted server be “https” instead of “http” which would fix the issue. Is that true or its only for custom websites ?

I guess it might work. The user may have to add some kind of security exception though…

Ok thanks.

No, this will only cause a lot of trouble. If you really want to follow that networking concept, stick to HTTP and WS instead of HTTPS and WSS. Also keep in mind that you can’t create a websocket server inside browsers. The hosting player will always need to run a standalone version of the game to create a server.

It sounds like you just want some simple player-hosted game without any online servers/services provided by you. In that case, take a look at WebRTC instead, which supports peer-to-peer networking inside browsers. See: WebRTC — Godot Engine (stable) documentation in English