Search code examples
winformspush-notificationsignalrsignalr-hubduplex

Consuming Signal R service in Desktop application


I am new to SignalR, I want to develop a service using SingalR API’s and Host as selfhost\IIS, now my doubt is How can I consume these message in Client side my client application will be Windows(Desktop) applications. Main intention is to send Notification from SignalR service to Clients. I would like to know is this achievable.

Please share any tutorials link or similar projects URL

Thanks in Advance


Solution

  • What I do is use .Net events , to wrap the SignlR client functions and connect to the desktop application call backs . like so :

    public class Client
    {
        public delegate void OnReciveMessage(Object message);
        public event OnReciveMessage MessageRecivedEvent;
    
        public void ReciveMessage(Object message)
        {
             if (MessageRecivedEvent != null)
             {
                  MessageRecivedEvent(message);
             }
        }
    }