SignalR client in Unity Android platform doesn't receive messages from server

25 Views Asked by At

I implemented signalr client in unity engine. I got the libraries from Nuget and add all of them in link.xml (In asset folder). Everything is ok when i run game in editor, but when i run on my device, after stablishing connection successfully and trying to authenticate with server messages from server doesn't recieve by client.

It's the first code that i wrote:

private async void StartConnection()
{
    _hub = new HubConnectionBuilder()
        .WithUrl(_configs.FullUrl)
        .WithAutomaticReconnect(new ReconnectPolicy())
        .Build();
            
            

    _hub.On<string>("Hello", (m) =>
    {
        Debug.Log("Hello");
        _actions.Enqueue(Login);
    });
    _hub.On<User>("SigninResponse", (user) =>{_actions.Enqueue(() => SigninResponse(user));});
    _hub.On<User>("SignupResponse", (user) => { _actions.Enqueue(() => SignupResponse(user)); });
    await _hub.StartAsync();        
    
}

"Hello" message sent by server right after establishing connection and it received by client. After that user will send signin or signup message. signin and signup messages successfully recieved and proccessed on server and no error or exceptions happens, but there is no response. I even change listeners to this:

_hub.On<object>("SigninResponse", (user) =>
{
    Debug.Log("sign in response from another thread general");
    Debug.Log(user);
});
_hub.On<object>("SignupResponse", (user) =>
{
    Debug.Log("sign up response from another thread general");
    Debug.Log(user);
});

But still no response.

0

There are 0 best solutions below