Can't to connect to photon server in WebGL websocket and websocketsecure
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Photon Server.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Can't to connect to photon server in WebGL websocket and websocketsecure
ntquang1999
2022-03-23 07:02:43
Hi,
I'm pretty new to networking. Right now I'm using latest PUN 2 package, using the Asteroid Demo to connect to a server I hosted on same machine, my personal computer. I use both v4 and v5, leave default config and get the Demo run on UDP normally.
But when I change to WebGL and change connect protocol to Websocket or WSS, the client can't connect. It still can connect to Photon Cloud via AppID normally.
The error is: Exiting receive thread. Server: ws://127.0.0.1:9093:0 Error: Abnormal disconnection.
Edit: I notice the weird ":0" in the URL, then I log out the real url that connect:
WebSocket connection to 'ws://127.0.0.1:9093/?libversion=4.1.6.11&sid=30&app=NameServer' failed:
My client photon settings are bellow
Are there any other thing I need to config so it can run?
Comments
@ntquang1999 do you see that port is set to 0 although it should be 9090 for WS and 19090 for WSS. Please note that for WSS you have to provide certificate
best,
ilya
Hi @ntquang1999,
Thank you for choosing Photon!
I wanted to clarify that in PUN's PhotonServerSettings if you keep port 0, the default NameServer port per protocol will be used. In this case (WebSockets), it will be 9093.
Please test using UDP or TCP first then switch to WebSockets (not WebSocketsSecure).
Not sure what is the exact failure reason. Could you paste full error message you get on the client? Also, did you check server logs?
ntquang1999
2022-03-23 20:33:29
chvetsov 2022-03-23T08:03:41+00:00
@ntquang1999 do you see that port is set to 0 although it should be 9090 for WS and 19090 for WSS. Please note that for WSS you have to provide certificate
best,
ilya
I set 9090 and still doesn't work. Then I try to remove the * on the url = "/*" of the NameServer config, then I can connect on local. I thought problem solve but when I switch to using LAN, change IP to 192.168.1.155, the others machine run on LAN can connect to Nameserver but not Masterserver
Hi @ntquang1999,
Please replace "/*" with "/+".
ntquang1999
2022-03-24 04:31:56
What are the differences between "/*" , "/+" and "/"
JohnTube 2022-03-23T20:34:30+00:00
Hi @ntquang1999,
Please replace "/*" with "/+".
- "/*" is not supported (at least not in v5 RC1).
- or * are probably RegEx thing: *: any zero or more chars, +: any one or more chars? I'm not sure, though, @chvetsov
may confirm.
"/" is simply no relative path, just root endpoint.
hi, @ntquang1999
/+ it is not regexp. it is just our way to do it.
best,
ilya
Back to top