new BaseTransport()
Base transport class. Allows to use single class for both client and server modes (as separate instances).
- Source:
Methods
(abstract) bootstrap() → {Promise.<Array>}
Do the transport-specific bootstrap process and return promise that
contains discovered nodes when fulfilled (both modes).
NOTE: Do not use nodes received by this method in addr
messages!
This is meaningless.
- Source:
Returns:
- Type
- Promise.<Array>
(abstract) broadcast(msg, payloadopt)
Send message to all connected clients (server mode only).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
msg |
Buffer | string | Encoded message or command string |
|
payload |
Buffer |
<optional> |
Message payload (used if the first argument is a string) |
- Source:
(abstract) close()
Close connection(s) and/or stop listening (both modes).
- Source:
(abstract) connect()
Connect to the transport-specific address. Enters client mode. Should
emit open
event after successful connect and established
event
after verack
messages exchange.
- Source:
(abstract) listen()
Listen for the transport-specific incoming connections. Enters server
mode. Should emit connection
event with a transport instance for
each new connection.
- Source:
(abstract) send(msg, payloadopt)
Send message over the wire (client mode only).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
msg |
Buffer | string | Encoded message or command string |
|
payload |
Buffer |
<optional> |
Message payload (used if the first argument is a string) |
- Source: