Using Gamelift Realtime with webgl Unity builds

0

I've got most of the process working but at the Client.connect() I come across this error in the webgl client:

SocketException: Success
System.Net.Sockets.Socket..ctor (System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType) (at <00000000000000000000000000000000>:0)
--- End of stack trace from previous location where exception was thrown ---

this also occurs when trying to collect a local udp port (I simply set it to -1) which causes the error to occur later on at client.connect()

Thank you for any help!

gefragt vor einem Jahr329 Aufrufe
1 Antwort
0

Hi! It is not clear to me exactly from the error you've shared what is causing this issue, however, I hope that I can nevertheless assist.

You mentioned UDP in your post. Unfortunately, web browsers do not natively support communication over raw TCP sockets or UDP. They support WebRTC DataChannels for unreliable unordered messaging and WebSockets for reliable ordered messaging, but these are specific protocols running on top of TCP and UDP. I suspect that what's happening here is that the GameLift Realtime Client SDK / Unity tries to prepare for receiving packets on TCP or UDP, but this is not supported for WebGL builds and that's why it's throwing the error. As per Unity's own documentation about networking in WebGL:

Note that you can’t use .NET networking classes, because JavaScript code doesn’t have direct access to IP Sockets to implement network connectivity.

My current understanding is that because of this browser limitation, WebGL builds are not supported in GameLift Realtime either. However, there is one thing you can try; you can try passing a custom ClientConfiguration to the GameLift Realtime Server Client constructor. Try changing the connectionType to something else. If you're using RT_OVER_WS_UDP_UNSECURED, try using RT_OVER_WSS_DTLS_TLS12 or RT_OVER_WEBSOCKET.

AWS
Joris_D
beantwortet vor einem Jahr
  • Thank you for the response, I suspected this was the issue.

    I was already using RT_OVER_WSS_DTLS_TLS12 and had thought since it was over wss (Websocket secured) it would work but I believe it utilizes unsecured socket types before making that final secured connection which is where the problem occurs.

    Regarding the UDP, I simply found that as the first cause of error but set a hard value instead of searching for it (which is of course not possible in webgl) - that lead to the next cause of error which was client.connect()

    Let me know if there is anything else I could do, thank you very much

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen