Setting up PlayCanvas w/ wss

I’m new to PlayCanvas and looking to use it for my online networked game, but I’m having trouble figuring out how to set up a websocket secure connection.

Initially, I attempted to connect via ws, which runs into the following error message:

Mixed Content: The page at 'https://launch.playcanvas.com/923539?debug=true' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://162.248.94.104:4296/'. This request has been blocked; this endpoint must be available over WSS.

No surprise there, I just switched my client to ‘wss’ and the server over to the ‘https’ package, with my SSL certificate that my website uses all set up.

This issue now - and this may be my lack of understanding of how SSL connections communicate with each other - is that I’m now receiving the error:

WebSocket connection to 'wss://162.248.94.104:4296/' failed: Error in connection establishment: net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH

At this point I’m not entirely sure how to solve the issue. I’m hoping that someone has experience with setting up wss connections with the editor build (which, ideally, would have no trouble being updated with a self-hosted build).

Hi @TingleyWJ and welcome!

Websockets through Playcanvas are definitely doable. Actually there isn’t anything special regarding Playcanvas for this, it’s a matter of setting up a regular Javascript script to connect to your websocket endpoint.

The error you are getting I think most likely is an issue with the certificates not properly loading (I got a similar message once when the certificates path wasn’t set properly on my backend). This is something to be resolved on your backend, most likely the code on the Playcanvas side is correct.

1 Like

If you just want to run insecurely, you can use http for the launch window.