https://metaplay.io logo
WebGL and mobile cross platform
# questions-and-feedback
d
Hi there, We've configured our game systems to work both on Crazygames (WebGL) and mobile platforms. However, when finishing setting up Metaplay for WebGL, we've encountered an issue on redirection, as it does not work as is with Websocket. The documentation indicates to change the port server port to 9380, https://docs.metaplay.io/feature-cookbooks/unity-sdk-features/webgl doing so in the Client Compatibility Settings makes the redirection work for WebGL, but it no longer works on other platforms. What can we do to solve this? Using Websocket for all platforms seems to be the only option. EDIT: does setting "WebSockets: Enabled: true" only seems to be effective for WebGL builds
j
Okay this is a bug in the server redirect. The server redirect target is currently shared between the platforms, but the websocket (for webgl builds) and native protocol (for device builds) at them moment require different ports. Generally we haven't expected use of the redirect for anything but Apple (and other native device) review flows as described in https://docs.metaplay.io/cloud-deployments/how-to-guides/rolling-out-updates For WebGL builds, our assumption has been that there is no need for redirect since the client deployment is controlled by the developer, and hence, developer can update the client whenever they want instead of having some blackbox review by external people. This assumption unfortunately ignores the case where both iOS build is submitted into review and webgl RC build is being tested, which I assume is the case here. If you want to get the redirect working, here's a quick patch for the client that should hardcode the ports to be correct per platform. Not beautiful, but should for now:
Copy code
diff --git a/MetaplaySDK/Client/Core/Network/ServerConnection.cs b/MetaplaySDK/Client/Core/Network/ServerConnection.cs
index 6064916c8e..329137729d 100644
--- a/MetaplaySDK/Client/Core/Network/ServerConnection.cs
+++ b/MetaplaySDK/Client/Core/Network/ServerConnection.cs
@@ -1449,6 +1449,10 @@ void HandleOngoingMaintenance(Handshake.OngoingMaintenance maintenance)
         void HandleRedirectToServer(Handshake.RedirectToServer redirect)
         {
             ServerEndpoint endpoint = redirect.RedirectToEndpoint;
+
+            // \METAPLAY_CHANGED: Default port to platform default port
+            endpoint = new ServerEndpoint(endpoint.ServerHost, serverPort: ServerEndpoint.CreateLocalhost().ServerPort, endpoint.EnableTls, endpoint.CdnBaseUrl, endpoint.PublicWebApiUrl, endpoint.BackupGatewaySpecs);
+
             if (endpoint != null)
d
thank you very much, it seems to be working indeed