Guaranteed delivery in SignalR

后端 未结 2 1824
情话喂你
情话喂你 2021-02-05 13:41

I\'m evaluating SignalR for a medium-load web application.

We\'re expecting ~500 msgs / sec, which shouldn\'t be a problem with SignalR.

However, we\'re worried

2条回答
  •  名媛妹妹
    2021-02-05 14:28

    You could ofcourse use some kind of queing framework but to achive this with minimum effort you can do it like this...

    Serverside: http://pastebin.com/tuicQYGq Clientside: http://pastebin.com/a8EbusuG

    I am using XSockets.NET that is a realtime communication platform (since 2009) and the controllers in XSockets.NET have state so this is easy to do.

    EDIT: Ohh... to test this use two browsers for example chrome and safari, then disconnect one browser... send some messages from the other then reconnect to see the messages appear. You have to use two different browsers on localhost since xsockets will give each browser a unique storage-id.

    EDIT: Added Func to the queue so that you can target specific clients even if they are offline. Now only clients matching conditions will get messages if you want to.

    Regards Uffe

提交回复
热议问题