Skip to content

The Client.HasConnected is null when using WebsocketTextMode in Unity.  #10

@SangonomiyaSakunovi

Description

@SangonomiyaSakunovi

The flowing shows where the bug occured, I was use the Unity2021.3, and build Target is WebGL.

private static KingClient _clientPeer;

private string _ip;
private ushort _port;
private NetworkListenerType _listenerType;

public ClientPeer_KingClient(string ip, ushort port)
{
    _clientPeer = new();
    _ip = ip;
    _port = port;
    _listenerType = NetworkListenerType.WSText;
}

public void Connect()
{
    _clientPeer.Connect(_ip, _port, _listenerType);

    if (_clientPeer.HasConnected)  //This line will get the bug, null refrence. 
    {
        Debug.Log("Connected!");   
    }
}

Thanks for your reading, and I am looking forward to your reply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions