Signalr client to retrieve missed messages on reconnect

梦想的初衷 提交于 2019-12-11 03:56:48

问题


I would like a user to retrieve messages that they may have missed when they re-connect to the Signalr server.

I know I could persist the messages independently of Signalr, keep track of the last message id received in the client and resend the newer messages on reconnect but I was looking at the SqlServer backplane's Messages_0 table which has a Payload and PayloadID and was wondering if there is a more Signalr'y way to get the backplane to do this for me or to extend the backplane to do this for me.

Do you any ideas how I might go about this?


回答1:


SignalR is more of a real time message system used to broadcast a request to connected clients. There isn't a built in way to track that the broadcasted message was retrieved by a particular decoupled client if you were sending to many clients. Service bus/queue mechanisms are more suited for that IE - MSMQ, Rhino Service Bus, RabbitMQ etc. You can definitely build a queue that handles the requests and keeps an eye on which identities are still connected to a hub and have SignalR handle the broadcasting portion of the communication and if an identity decouples and comes back to a group resend only to that identity.

The only thing about going a pure service bus method is that a client would have to have the protocol set up properly on their machines such as MSMQ needing the MSMQ Server Core Integration, which adds to the complexity of deploying.



来源:https://stackoverflow.com/questions/27017387/signalr-client-to-retrieve-missed-messages-on-reconnect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!