1

I have been trying building application that receive notification on real time basis using SignalR. Now I have some application which send notifications with user id to my application and I am storing that data in dictionary. Now to receive those notification I need to pick only those entries from dictionary which equal to my login user id. How can I do this as session variable not accessible in class

Following is my Send function that calls to broadcast message

public void Send(string name, string message)
    {
        SortedDictionary<int, string> dicMessage = new SortedDictionary<int, string>();                                       

            if (!dicMessage .ContainsKey(nUserID))
            {                   
                    m_hs.Add(nUserID, message);                    
            }                              
    }        

and here my Receive function

 public void Receive(string strSessionID)
    {
        // here I need to first check my user ID but not available
    }
Rajeev Kumar
  • 4,901
  • 8
  • 48
  • 83

1 Answers1

0

Sessions are not supported in SignalR, you can use Thread.CurrentPrincipal or Context.Userto get the user name if you use standard ASP.NET security

Anders
  • 17,306
  • 10
  • 76
  • 144