Home Reference Source
public class | source

Unicast

Extends:

* → Unicast

Unicast represent the base implementation of an unicast protocol for the foglet library.

Constructor Summary

Public Constructor
public

constructor(source: AbstractNetwork, protocol: string)

Constructor

Member Summary

Private Members
private

Method Summary

Public Methods
public

send(id: string, message: *): Promise

Send a message to a peer using its ID.

public

sendMultiple(ids: string[], message: Object): Promise

Send a message to multiple peers

Private Methods
private

_receive(id: string, message: *): void

Handler executed when a message is recevied

Public Constructors

public constructor(source: AbstractNetwork, protocol: string) source

Constructor

Params:

NameTypeAttributeDescription
source AbstractNetwork

The source RPS/overlay

protocol string

The name of the unicast protocol

Private Members

private _unicast: * source

Public Methods

public send(id: string, message: *): Promise source

Send a message to a peer using its ID. This peer must be a neighbour.

Params:

NameTypeAttributeDescription
id string

The id to send the message

message *

The message to send

Return:

Promise

A Promise fulfilled when the message is sent

public sendMultiple(ids: string[], message: Object): Promise source

Send a message to multiple peers

Params:

NameTypeAttributeDescription
ids string[]

Set of peer IDs

message Object

Message to send

Return:

Promise

A Promise fulfilled when all message have been sent

Private Methods

private _receive(id: string, message: *): void source

Handler executed when a message is recevied

Params:

NameTypeAttributeDescription
id string

Message issuer's ID

message *

The message received

Return:

void