Show / Hide Table of Contents

Class FloodRouter

The original flood sub router.

Inheritance
Object
FloodRouter
Implements
IPeerProtocol
IMessageRouter
IService
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: PeerTalk.PubSub
Assembly: PeerTalk.dll
Syntax
public class FloodRouter : IPeerProtocol, IMessageRouter, IService

Properties

| Improve this Doc View Source

Name

The name of the protocol.

Declaration
public string Name { get; }
Property Value
Type Description
String
| Improve this Doc View Source

RemoteTopics

The topics of interest of other peers.

Declaration
public TopicManager RemoteTopics { get; set; }
Property Value
Type Description
TopicManager
| Improve this Doc View Source

Swarm

Provides access to other peers.

Declaration
public Swarm Swarm { get; set; }
Property Value
Type Description
Swarm
| Improve this Doc View Source

Version

The version of the protocol.

Declaration
public SemVersion Version { get; }
Property Value
Type Description
Semver.SemVersion

Methods

| Improve this Doc View Source

InterestedPeers(String)

Gets the sequence of peers interested in the topic.

Declaration
public 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 topic.

| Improve this Doc View Source

JoinTopicAsync(String, CancellationToken)

Indicates that the local peer is interested in the topic.

Declaration
public 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.

| Improve this Doc View Source

LeaveTopicAsync(String, CancellationToken)

Indicates that the local peer is no longer interested in the topic.

Declaration
public 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.

| Improve this Doc View Source

ProcessMessageAsync(PeerConnection, Stream, CancellationToken)

Process a message for the protocol.

Declaration
public Task ProcessMessageAsync(PeerConnection connection, Stream stream, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
PeerConnection connection

A connection between two peers.

Stream stream

The message source.

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.

| Improve this Doc View Source

ProcessSubscription(Subscription, Peer)

Process a subscription request from another peer.

Declaration
public void ProcessSubscription(Subscription sub, Peer remote)
Parameters
Type Name Description
Subscription sub

The subscription request.

Peer remote

The remote Peer.

Remarks

Maintains the RemoteTopics.

See Also
RemoteTopics
| Improve this Doc View Source

PublishAsync(PublishedMessage, CancellationToken)

Sends the message to other peers.

Declaration
public 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.

| Improve this Doc View Source

StartAsync()

Start the service.

Declaration
public Task StartAsync()
Returns
Type Description
Task
| Improve this Doc View Source

StopAsync()

Stop the service.

Declaration
public Task StopAsync()
Returns
Type Description
Task
| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()

Events

| Improve this Doc View Source

MessageReceived

Raised when a new message is received.

Declaration
public event EventHandler<PublishedMessage> MessageReceived
Event Type
Type Description
EventHandler<PublishedMessage>

Implements

IPeerProtocol
IMessageRouter
IService
  • Improve this Doc
  • View Source
Back to top Generated by DocFX