I have a service application that works very similar to the SignalR backplane, so I thought it would be nice to create my own implementation of IMessageBus to talk to the backend rather than deploying my own thing. The problem is that I can not find much information about this contract. Although I look at the code (which looks very good), I'm struggling to understand some concepts.
public interface IMessageBus { Task Publish(Message message); IDisposable Subscribe(ISubscriber subscriber, string cursor, Func<MessageResult, object, Task<bool>> callback, int maxMessages, object state); }
Task Publish(Message message);
It is easy, basically it should send a message to the server. I am not worried about this because my application is unidirectional from server to client.
IDisposable Subscribe(ISubscriber subscriber, string cursor, Func<MessageResult, object, Task<bool>> callback, int maxMessages, object state);
return : Despite saying IDisposable , I saw that it always returns a Subscription object, but why is IDisposable ?subscriber identifies the compound. This connection may subscribe or unsubscribe to groups.cursor : this is the last message id received.callback : when is this callback executed?state : what exactly is it?
Can someone explain to me how this method works?
signalr signalr-backplane
vtortola
source share