Search code examples
asp.netsignalrsignalr-hub

change old signalR hub to new version


I have chat sample using the old signalr dll version[0.5.3] and I want to make it in the new AspNet.SignalR library version 2.2.0 the old sample have Clients[chatRoom.chatRoomId]. where the Clients was a dynamic property in hub class. but in the new hub the Clients is not dybamic.

How can I fix it in the new version?


Solution

  • It depends on what your chatRoomId is: if it is a group identifier, as I would assume, you just need to do this:

    Clients.Groups(chatRoom.chatRoomId). ...
    

    and there you have your dynamic object. In general, Clients has become a container for more specific groups, like All, Others, Caller, etc. Those ones are dynamic and can be used as you were used to before. Check here.