Use hubs in ASP.NET Core SignalR | Microsoft Learn Receiving messages from client with an interface

PHOTO EMBED

Sun Jul 02 2023 18:34:14 GMT+0000 (Coordinated Universal Time)

Saved by @cameron_v_r

public interface IClient
{
    Task<string> GetMessage();
}

public class ChatHub : Hub<IClient>
{
    public async Task<string> WaitForMessage(string connectionId)
    {
        string message = await Clients.Client(connectionId).GetMessage();
        return message;
    }
}
content_copyCOPY

https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view