Launch in http instead of https

I’m develop a multiplayer game, and am connecting to a local websocket (ws:// url), but since the playcanvas launch window is always in https://, it’s forcing me to use wss:// . This involves getting a certificate, and setting up SSL on the development websocket server. I’m wondering if there is a way to configure the launch window to run in http instead?

This would be helpful for many engine users to quickly get multiplayer or websockets up and running. I couldn’t find a setting for this from a quick search.

Due to security reasons, I’m afraid not, no.

Thanks for the fast reply.

You can also set up your local WebSocket server to use a self-signed certificate. You just have to set one browser flag to allow self-signed localhost certificates. In Chrome, simply paste: chrome://flags/#allow-insecure-localhost into the address bar and then set the #allow-insecure-localhost dropdown to allow.

I prefer this approach because the SSL config is practically identical for both development and production. Development uses the self signed cert and key, then in production, I simply update the .env file to point to the production SSL cert and key.

6 Likes

Update: This solution no longer works. The allow-insecure-localhost flag has been removed from Google Chrome 119 and onwards.

As a workaround, you can instead use Chrome canary: https://www.google.com/chrome/canary which still has the flag (for now).

2 Likes