Extends
- EventEmitterExtra
Members
(static, readonly) ErrorCode :string
- Source:
Properties:
Name | Type | Description |
---|---|---|
INVALID_JSON |
string |
|
MISSING_ID |
string |
|
ALREADY_RESPONDED |
string |
|
Type:
- string
(static, readonly) Name :string
- Source:
Properties:
Name | Type | Description |
---|---|---|
RESPONSE |
string |
|
HANDSHAKE |
string |
|
PING |
string |
|
These message names are reserved for internal usage.
We recommend to not use any message name starts with _
(underscore).
Type:
- string
Methods
reject(erropt)
- Source:
Rejects the message, with sending error response back to the source.
This method can throw:
Message.ErrorCode.MISSING_ID
: Message source is not expecting a response.Message.ErrorCode.ALREADY_RESPONDED
: This message is already responded.Message.ErrorCode.INVALID_JSON
: Could not stringify payload. Probably circular json.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
any |
<optional> |
resolve(payloadopt)
- Source:
Resolves the message with sending a response back. If the source does not expecting a response, you don't need to call these methods.
This method can throw:
Message.ErrorCode.MISSING_ID
: Message source is not expecting a response.Message.ErrorCode.ALREADY_RESPONDED
: This message is already responded.Message.ErrorCode.INVALID_JSON
: Could not stringify payload. Probably circular json.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
payload |
any |
<optional> |