Unity WebGL and Photon 4
Options
cpgames
✭
Hi. Is Unity WebGL supported with photon server 4 (sdk)? And if so how do I connect?
I've opened 5055 UDP and 9090 TCP, but when I try to connect I just see "SocketException: Success" message.
I've opened 5055 UDP and 9090 TCP, but when I try to connect I just see "SocketException: Success" message.
0
Comments
-
-
Hi I am using Unity SDK with self hosted server.
I've followed the docs and now sever shuts down with the following log:
40752: 19:30:39.740 - CertOpenSystemStore() - failed - Access is denied.
40752: 19:30:39.741 - CService::OnException() - Exception: CreateCredentials() - No certificate available
40752: 19:30:39.741 - Server shutting down...
This is the WebSocketListeners config:<WebSocketListeners> <WebSocketListener IPAddress="0.0.0.0" Port="9090" DisableNagle="true" InactivityTimeout="10000" OverrideApplication="Master" Secure = "true" StoreName = "MY" CertificateName = "*.chillpillgames.com" UseMachineStore = "true"> </WebSocketListener> <WebSocketListener IPAddress="0.0.0.0" Port="9091" DisableNagle="false" InactivityTimeout="10000" OverrideApplication="PAServer" Secure = "true" StoreName = "MY" CertificateName = "*.chillpillgames.com" UseMachineStore = "true"> </WebSocketListener> </WebSocketListeners>
At the moment I am only hosting locally so I have my certificate in Personal/Certificates:
p.s. I can run server/connect via UDP just fine0 -
if I set "UseMachineStore = false"
then I get this error:
13076: 20:34:45.219 - CService::OnException() - Exception: CCredentials::CreateCredentialsHandle() - No credentials are available in the security package
0 -
Ok I've got server working. I've had to run Visual Studio in Administrator mode, then certificate worked.
But now I can't connect to the server using websocket address.
What should the WebSocketListener's IPAddress parameter be? It says 0.0.0.0 in config, is that correct?
I am connecting to localhost from within Unity Editor (set to WebGL platform). Should this work?
address string: "wss://localhost:9091"
PhotonPeer is initialized with WebSocketSecure protocol.
I am not seeing any response from IPhotonPeerListener not even ExceptionOnConnect.
as mentioned earlier, I can connect with UDP protocol fine.
0 -
Sorry my Websockets configuration is currently just this this:
<WebSocketListeners> <WebSocketListener IPAddress="0.0.0.0" Port="9090" DisableNagle="false" InactivityTimeout="10000" OverrideApplication="PAServer" Secure = "true" CertificateName = "*.chillpillgames.com" UseMachineStore = "true"> </WebSocketListener> </WebSocketListeners>
connecting to 9090 with "wss://localhost:9090"
I removed Master b/c I am not running loadbalanching (I shouldn't have to?).
Log only says
15044: 11:46:48.884 - Adding WebSocket TCP listener on: 0.0.0.0: 9090 with a listen backlog of: 150
and
15044: 11:46:48.908 - Service is running...
Also I noticed that versions of Photon3Unity3D.dll in Unity Realtime and Server SDK are different. The one in Unity demos is newer and sets peer.SocketImplementationConfig in demo client code. But I couldn't get either to work with websockets. I get no response from either client or server after connection, no error/logs, it just suspends in "connecting state".
this is my log and config xml just in case: https://drive.google.com/file/d/1iwdygx-QLwONOarx7ffTW46ZzZo1_tl3/view?usp=sharing
Not sure what else I can try..0 -
Ok, I've got it connecting in Unity Editor.
I was missing this part:#if UNITY_WEBGL || WEBSOCKET || (UNITY_XBOXONE && UNITY_EDITOR) SocketWebTcp.SerializationProtocol = Enum.GetName(typeof(SerializationProtocol), SerializationProtocol.GpBinaryV16); #endif peer.SerializationProtocolType = SerializationProtocol.GpBinaryV16;
Now I made a webGL build and trying to connect from Chrome. Log shows:
WebSocket connection to 'wss://localhost:9090/' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID
I am guessing my personal certificate is not recognized by Chrome? Also I am using localhost since I am running server on the same computer. Will this work with Chrome?
Also, I've imported certificate into Chrome, but that didn't fix it.0 -
looks like I've got it working. Needed to install certificate in the trusted root store and make sure common name matches the server dns.0
-
great news
best,
ilya0