Forum Multiplayer Unity/WebGL cant connect.

Discussion and help relating to the PlayerIO Multiplayer API.

Unity/WebGL cant connect.

Postby AncientEmpireGames » July 20th, 2020, 4:41 am

Hi I made a little game in unity using playerIO. In the editor everything works fine but when I upload a WebGL build to Itch.io I an not seem to connect. I have tried both adding "PlayerIO.UseSecureApiRequests = true;" and "client.Multiplayer.UseSecureConnections = true;" to no avail. Is there something I need to do to get WebGL clients to connect? Any help would be appreciated. Im using unity 19.3.14 and the June 2020 PlayerIO sdk.

Code: Select all
void ConnectToNetwork()
        {
            //PlayerIO.UseSecureApiRequests = true;
            PlayerIO.Authenticate
            (
                "hidden",
                "public",
                new Dictionary<string, string> { { "userId", _localPlayerName } },
                null,
                delegate (Client client)
                {
                    //Debug.Log("Successfully connected to Player.IO");

                    // Comment out the line below to use the live servers instead of your development server
                    client.Multiplayer.DevelopmentServer = new ServerEndpoint("hidden", 8184);
                    //client.Multiplayer.UseSecureConnections = true;

                    //Debug.Log("CreateJoinRoom");
                    //Create or join the room
                    client.Multiplayer.CreateJoinRoom(_roomName, "DwarvenArenaMatchServer", false, new Dictionary<string, string> { { "privateGame", "true" } }, null,
                        delegate (Connection connection)
                        {
                            //Debug.Log("Joined Room.");
                            _pio = connection;
                            _pio.OnMessage += HandleMessage;
                            _joinedRoom = true;
                        },
                        delegate (PlayerIOError error)
                        {
                            ErrorMessageController.Instance.ShowError("Failed to join! WTF, dude? " + error.ToString(), true);
                            Debug.Log("Error Joining Room: " + error.ToString());
                        }
                    );
                },
                delegate (PlayerIOError error)
                {
                    ErrorMessageController.Instance.ShowError("Failed to connect! WTF, dude? " + error.ToString(), true);
                    Debug.Log("Error connecting: " + error.ToString());
                }
            );
        }
AncientEmpireGames
Paid Member
 
Posts: 1
Joined: July 18th, 2020, 5:35 pm

Re: Unity/WebGL cant connect.

Postby robscherer123 » July 20th, 2020, 2:21 pm

Are you receiving any errors or anything if you open the browser console window? Or also if you use the PlayerIO error callback? I ran a game on PlayerIO and WebGL, so it should be workable.
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Re: Unity/WebGL cant connect.

Postby lanikane68 » August 17th, 2022, 8:17 am

You use the PlayerIO error callback. I also tried "PlayerIO.UseSecureApiRequests = true;" and "client.Multiplayer.UseSecureConnections = true;" no result. Hoping for help.
phrazle weaver wordle
lanikane68
 
Posts: 1
Joined: August 17th, 2022, 8:12 am


Return to Multiplayer