WebGL + Unity 5 + (Secure)Websocket - Self Hosted - Not working

Hello All,

I have been using PUN for awhile now but this is my first post in these forums, so hello!

Let me explain my situation. I was using Unity Web Player for builds until a couple days ago when Chrome updated their browser to finally do away with NPAPI. Many users use Chrome so the potential for players on a game goes down, when you tell people, "Sorry it doesn't work in chrome."

So I thought, okay lets do some research and see what alternatives we have for this. I came across some information from the Unity Team about a feature they're implementing called WebGL. (It works but I think it's in preview mode still.)

So this is the route I decided to go. I currently host a photonserver (so I can have the 100ccu limit) on a laptop, all ports forwarded, etc, has worked great and still does as long as I don't try to use it for Websocket hosting. I have followed the tutorial from here:
https://doc.photonengine.com/en/onpremise/current/reference/websockets-ssl-setup

I have verified in the logs that it sees the certificate.

Since I am using my laptop as a server here is what I have done:
1. Created the certificate in IIS
2. Verified it in the Personal MMC Certificate folder
3. Updated the text file with SSL info.
4. Updated PUN from the Unity Asset store
5. Restarted Unity
6. Restarted my server laptop

In Unity, for the PhotonServerSettings file I have typed the following:
Server Address: (ws://laptopipaddress @ Port 9090) and I've tried (wss://laptopipaddress @ port 9091)
Tried both options above with TCP and UDP ^

Checked this documentation to make sure I'm configuring the correct ports:
https://doc.photonengine.com/en/realtime/current/reference/tcp-and-udp-port-numbers


I get this error with ws:// @ 9090:

Unity Error:
Exiting receive thread due to error: An exception has occurred while receiving a message. / WebSocketSharp.WebSocketException: The header part of a frame cannot be read from the data source.
at WebSocketSharp.WebSocketFrame+<>c__DisplayClass7.b__6 (System.Byte[] header) [0x00000] in :0
at WebSocketSharp.Ext+<>c__DisplayClass6.b__5 (IAsyncResult ar) [0x00000] in :0
UnityEngine.Debug:LogError(Object)
PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:173)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1105)
ExitGames.Client.Photon.c__Iterator2:MoveNext() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/SocketWebTcp.cs:174)


Server Log Error: MSMaster.log:
2015-09-04 23:24:33,535 [14] WARN Photon.SocketServer.Protocol [(null)] - Subprotocol GpBinaryV16 is unknown
2015-09-04 23:24:33,535 [14] WARN Photon.SocketServer.ApplicationBase [(null)] - OnInit - Failed to parse init request for WebSocket peer: {0}System.Byte[]


I get a different error with wss:// @ 9091 it actually tries to connect in Unity and won't error out but in the MSMaster.log file it says the same as above:
2015-09-04 23:26:08,705 [15] WARN Photon.SocketServer.Protocol [(null)] - Subprotocol GpBinaryV16 is unknown
2015-09-04 23:26:08,705 [15] WARN Photon.SocketServer.ApplicationBase [(null)] - OnInit - Failed to parse init request for WebSocket peer: {0}System.Byte[]


I've tried every combination of ws:// and wss:// with my public ip, local ip, udp, tcp, everything.
For now, I am able to get the game running if I go from Self-Hosted to PhotonCloud. Cloud works just fine so I'm certain there is something I'm doing wrong.

Thanks for taking the time to read this and let me know if I can provide any more information.

Thanks!


Edit: 9/4/2015 @ 11:43pm

I've also poked around here:
https://doc.photonengine.com/en/onpremise/current/getting-started/server-config#cpssac

Comments