Help~ Got connection failed: Error during WebSocket handshake: Unexpected response code: 400
Hello~
I have a problem connecting to the photon server by unity webGL. It's work fine in Unity Editor, but failed to make a WebSocket connection when being exported to H5 program. I've really have no idea with the problem. Help!
Here's some details:
Unity version:Unity 2019.4.36f1
Pun:2.40 Photon lib:4.1.6.11
Photon server:v5-0-12-24499-rc1
Logs:
I: new SocketWebTcp() for Unity. Server: wss://xxxxx.snowtime.fun:443
E: WebSocket connection to 'wss://xxxxx.snowtime.fun/?libversion=4.1.6.11&sid=30&app=' failed: Error during WebSocket handshake: Unexpected response code: 400
E: writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!
E: Exiting receive thread. Server: wss://xxxxx.snowtime.fun:443:0 Error: abnormal closure
I: SocketWebTcp.Disconnect()
I: TPeer.Disconnect()
I: SocketWebTcp.Disconnect()
Answers
-
Port 443 doesn't look correct, it should be 19093 if you haven't modified the configuration file yourself.
Make sure you have proper SSL certificates installed as well, and finally make sure you are on Secure WebSockets.
0 -
It's work fine in Unity Editor, but failed to make a WebSocket connection when being exported to H5 program.
What is a H5? Is it WebGL? Which browser (and version) do you use?
Are you running client, webserver and Photon Server on the same host name? Do you even have a host name for the webserver?
0 -
@TPLuFFy lets try to use native logging to see what is going on
in PhotonServer.config right after instance node please add next xml code:
<Log File="[CONFIG]/PhotonServer.Log.config"/>
place file PhotonServer.log.config next to PhotonServer.config. Content should be like this:
<?xml version="1.0" encoding="utf-8"?> <Configuration> <Instance Name="LoadBalancing"> <Log Dump="true"> <All Level="ERROR"/> <Photon Level="ERROR"/> <Config Level="INFO|WARN|ERROR"/> <WebSocket Level="TRACE|INFO|WARN|ERROR"/> </Log> </Instance> </Configuration>
before testing please remove old logs and send us logs from bin_win64/log folder right after testing
best,
ilya
0 -
0