Godot Version
4.7
Question
I asked this question on the Discord, and I figure I’ll ask here, too.
I’m trying to build a sort of Jackbox-esque local party game, where the game server runs on desktop, and the clients are HTML5, with the players going to the web page (either locally hosted and spun up by the game server, or hosted on itch.io) on their phones.
So I’m testing Web Sockets with the WebSockets Chat Demo, and I’m having issues accessing the LAN on the HTML5 export. If the web page is hosted and accessed from the same machine without a security certificate (i.e. by running serve.py on the HTML5 export), the client can connect to the desktop host on another device no problem. As soon as https gets involved, things fall apart. If I host the website with a developer certificate, LAN access is denied, even if the desktop host is on the same machine, and if I host with a legit certificate (i.e. hosting it on itch.io), LAN access is still denied.
The thing about hosting on itch is that Local Network Access doesn’t appear to even be being requested, because I’m not getting any permission pop-up. I’ve tried using JavaScripBridge.eval to check the permissions, but since navigator.permissions.query({ name: “local-network” }) returns a Promise, all I get is null.
So what the heck is going on? Why is it not throwing the Local Network Access permission prompt when a local address is entered? Is the problem that I’m not using TLS on the chat server on the desktop, but the HTML5 client is, so wants wss instead of ws? If that’s the case, how do I get a dummy TLS certificate for the server?
For testing purposes I’d also really like a way to be able to host on a machine without TLS but access the hosted page from another device on my LAN, but when I do that I get the SecureContext fail. I’ve tried removing the SecureContext check, but it throws a weird audio device error when I do that.