Unicast
Extends:
Unicast component that simply sends messages to a neighbor. It provides easy-to-use event-like functions on top of a peer-sampling protocol. Protocols can send messages using unicast.emit('eventName', neighborId, args) and the neighbor can catch them using unicast.on('eventName', args).
Constructor Summary
Public Constructor | ||
public |
constructor(psp: IPSP, options: object) |
Member Summary
Public Members | ||
public |
Send a message using the emit function. |
|
public |
options: * |
|
public |
psp: * |
Private Members | ||
private |
_emit: * |
Method Summary
Public Methods | ||
public |
destroy() Destroy all listeners and remove the send capabilities |
Public Members
public emit(event: string, peerId: string, args: object[]): Promise: * source
Send a message using the emit function.
Return:
Promise | Resolved if the message seems to have been sent, rejected otherwise (e.g. timeout, unkown peers). |