The issue has been troubling me for almost a week,First, when encryption is not used, everything works fine, and my WebGL client can connect to the server version running on the cloud server. However, once encryption is enabled, the connection fails. I have configured the SSL certificate and key, and the certificate is a free certificate I applied for, not a self-signed certificate. After deploying the server version to my cloud server, I can’t even run it through the editor, and it prompts a ‘Failed to connect to the server.’ I want to know what might be causing the issue and whether I can use a self-signed certificate directly.
Can anyone help answer this question? I would be very grateful.
What exact server are you running and does your server have CORS properly configured? Your SSL certificate was actually created for the domain you’re hosting on, right? You can not use a certificate that was created and signed for a different domain. That’s a key part of SSL.
I haven’t yet used Netcode, so I’m not that familiar with the infrastructure. I’ve written my own websocket server some time ago What information can you gather from the developer console of your browser? You usually can also debug websocket connections. But the connection should usually start with a normal request in the network tab. Which browser do you use?
I didnt have any issues with netcode when my website is access as https, normally cors isnt visible from desktop to website only from website to website, so i guess the question is which call is failing?
The game is running at https://dosusang.itch.io/grid. I haven’t configured CORS, and what’s even stranger is that my development machine can connect to the server, but my phone and my friend’s devices cannot. The browser shows a wss connection failed error.
And the editor still cannot connect.
Well, it seems to work for me. I can load the game and the websocket connection was successful. You used port 7777
Which browser do you use? I use FireFox (since it came out )
wattt!!!,Why can you connect? My development machine’s Edge and Chrome can connect, but Chrome on my phone cannot.
I can’t connect from my Android phone as well. This may be an IPv4 vs IPv6 issue. Android usually perfers IPv6, but that’s just a wild guess
写给看到这里的阿里云用户,最终我发现是阿里云服务器在域名没备案之前会禁用https连接,这直接导致了websockets协议用不了
Finally, I discovered that Alibaba Cloud servers disable HTTPS connections before domain registration is completed, which directly caused the WebSocket protocol to be unusable.