An object
is a message which is shared throughout a stream. It is
the only message which propagates; all others are only between two
nodes.
Methods
(static) decode(buf, optsnullable) → {Object}
Decode object
message.
NOTE: nonce
and objectPayload
are copied.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
buf |
Buffer | Message |
|
opts |
Object |
<nullable> |
Decoding options |
- Source:
Returns:
Decoded object
structure.
- Type
- Object
(static) decodePayload(buf, optsnullable) → {Object}
Decode object
message payload.
NOTE: nonce
and objectPayload
are copied.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
buf |
Buffer | Message payload |
|
opts |
Object |
<nullable> |
Decoding options |
- Source:
Returns:
Decoded object
structure.
- Type
- Object
(static) encode(opts) → {Buffer}
Encode object
message.
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | Object options |
- Source:
Returns:
Encoded message.
- Type
- Buffer
(static) encodePayload(opts) → {Buffer}
Encode object
message payload.
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | Object options |
- Source:
Returns:
Encoded payload.
- Type
- Buffer
(static) encodePayloadWithoutNonce(opts) → {Buffer}
Encode object
message payload without leading nonce field (may be
useful if you are going to calculate it later).
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object | Object options |
- Source:
Returns:
Encoded payload.
- Type
- Buffer