Home Reference Source
public class | source

IPSP

Interface that peer-sampling protocol must implement for this module to work.

Method Summary

Public Methods
public

send(peerId: string, message: object, retry: number): Promise

Send a message to a peer.

Private Methods
private

_receive(peerId: string, message: object)

Receive a message from a peer.

Public Methods

public send(peerId: string, message: object, retry: number): Promise source

Send a message to a peer.

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer to send the message to.

message object

The message to send.

retry number
  • optional
  • default: 0

Retry to send the message once per second during retry milliseconds

Return:

Promise

Resolved if the message has been sent, rejected otherwise.

Private Methods

private _receive(peerId: string, message: object) source

Receive a message from a peer.

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer that sent the message.

message object

The message received.