Base solution for your next web application
Open Closed

Accessing SignalR in a Console desktop app #10450


User avatar
0
tbentley created

I'm using AspNetZero version 10.3.0 I have been using the Server and angular client for about a year now (previous project for about 6 years)

I would now like to create a console app that uses the AzureSignalR to pass data back and forth real-time.

I have followed a lot of online samples and have a console app communicating with my AzureSignalR.

The problem I am having is getting the online clients. I have, as a test, in my DispatchAppService.cs

    public async Task SendMessage(string message)
    {

        var onlineClients = _onlineClientManager.GetAllClients();

        await _dispatchCommunicator.SendMessage(onlineClients, message);
    }

but the onlineClients never has any clients even when I have sign on with the angular CLient. How can I see and send data to the console app client?

Thanks... Terry


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    By default, OnlineClientManager uses in-memory clien store, see https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/RealTime/InMemoryOnlineClientStore.cs

    You can create a new implementation of InMemoryOnlineClientStore which for example uses Redis cache and replace InMemoryOnlineClientStore with your own implementation.

  • User Avatar
    0
    tbentley created

    Thanks, that helped. Rather than worrying about the current online users I just, for now, did a broadcast message and it worked!! It is not as secure but the payload is not really confidential and the client would still need to have the credentials to the Azure SignalR connection.