Interface IMessageRouter
Routes pub/sub messages to other peers.
Namespace: PeerTalk.PubSub
Assembly: PeerTalk.dll
Syntax
public interface IMessageRouter : IService
Methods
| Improve this Doc View SourceInterestedPeers(String)
Gets the sequence of peers interested in the topic.
Declaration
IEnumerable<Peer> InterestedPeers(string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| String | topic | The topic of interest or null for all topics. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Peer> | A sequence of Peer that are subsribed to the
|
JoinTopicAsync(String, CancellationToken)
Indicates that the local peer is interested in the topic.
Declaration
Task JoinTopicAsync(string topic, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| String | topic | The topic of interested. |
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
LeaveTopicAsync(String, CancellationToken)
Indicates that the local peer is no longer interested in the topic.
Declaration
Task LeaveTopicAsync(string topic, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| String | topic | The topic of interested. |
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
PublishAsync(PublishedMessage, CancellationToken)
Sends the message to other peers.
Declaration
Task PublishAsync(PublishedMessage message, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| PublishedMessage | message | The message to send. |
| CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
Events
| Improve this Doc View SourceMessageReceived
Raised when a new message is received.
Declaration
event EventHandler<PublishedMessage> MessageReceived
Event Type
| Type | Description |
|---|---|
| EventHandler<PublishedMessage> |