question

theo avatar image
theo asked

Implementing Lobby notifications with C# and Microsoft.AspNetCore.SignalR.Client

Hi,

I'm trying to add matchmaking to our cross-platform game. It must run on android, so I had to generate C# code from the Rest API and as far as I've tested, it's running well. The pain point at the moment is the real time notifications for the lobby and matchmaking API.

I have managed to connect to the SignalR Hub using Microsoft.AspNetCore.SignalR.Client lib, but I fail to understand how to start a session as described here.

The relevant code section looks like this

_connection = new HubConnectionBuilder()
    .WithUrl("https://mygameid.playfabapi.com/pubsub", ConfigureHttpConnection)
    .Build();

_connection.On<string, string>("ReceiveMessage", (user, message) =>
{
    Debug.Log(user + "; " + message);
});

_connection.On<string, string>("ReceiveSubscriptionChangeMessage", (user, message) =>
{
    Debug.Log(user + "; " + message);
});

try
{
    await _connection.StartAsync();

    string payload = "{\"type\": 1, \"target\": \"StartOrRecoverSession\", \"arguments\": [{\"oldConnectionHandle\": \"\", \"traceParent\": \"00-84678fd69ae13e41fce1333289bcf482-22d157fb94ea4827-01\"}]}";
    var responseString = await _connection.InvokeAsync<string>("StartOrRecoverSession", payload);

    if (responseString != null)
    {
        Debug.Log(responseString);
    }
}
catch (Exception ex)
{
    Debug.Log(ex.Message);
}

From what I've read so far, I feel like I should pass the argument to StartOrRecoverSession this way. I've also tried without any arguments or by supplying the two expected string directly but none of that works.

This post was my entry point about Unity and SignalR and then I tried to make sense of this.

Do you have any idea what I could be missing ?

unity3dMatchmakingandroid
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

We are not expert on SignalR. For the issues about configuring SignalR, please contact Azure for professional support.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]