Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SangonomiyaSakunovi opened this issue Oct 21, 2024 · 0 comments

Comments

@SangonomiyaSakunovi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant