Namespace: broadcast

bitmessage/objects. broadcast

Methods

(static) decodeAsync(buf, opts) → {Promise.<DecodeResult>}

Decode broadcast object message.

Parameters:
Name Type Description
buf Buffer

Message

opts Object

Any of object.decode options and:

Properties
Name Type Description
subscriptions Array.<Address> | Address | Object

Address objects which represent broadcast subscriptions. It is either addresses array or single address or Object addr-by-tag/addr-by-ripe. Time to match the key is O(n), O(1), O(1) respectfully.

Source:
Returns:

A promise that contains decoded broadcast structure when fulfilled.

Type
Promise.<DecodeResult>

(static) decodePayloadAsync()

Decode broadcast object message payload. The same as decodeAsync.

Source:

(static) encodeAsync(opts) → {Promise.<Buffer>}

Encode broadcast object message.

Parameters:
Name Type Description
opts Object

broadcast object options

Properties
Name Type Attributes Description
ttl number

Time to live in seconds

from Address

Originator of the message

message string | Buffer

Message

subject string | Buffer <optional>

Subject for SIMPLE encoding

encoding number <optional>

Encoding of the message (TRIVIAL by default)

skipPow boolean <optional>

Do not compute POW (false by default)

Source:
Returns:

A promise that contains encoded message when fulfilled.

Type
Promise.<Buffer>

(static) encodePayloadAsync()

Encode broadcast object message payload. The same as encodeAsync.

Source:

Type Definitions

DecodeResult

Type:
  • Object
Properties:
Name Type Attributes Description
nonce Buffer

A 8-byte object nonce

ttl number

Time to live in seconds

expires Date

Object expiration date

type number

Object type

version number

Object version

stream number

Object stream

headerLength number

Length of the object header

tag Buffer

Tag derived from the address object used to send this broadcast (present only for object version >= 5)

senderVersion number

Sender's address version

senderStream number

Sender's stream

behavior Object

Sender's pubkey features that can be expected from the node

signPublicKey Buffer

Sender's signing public key

encPublicKey Buffer

Sender's encryption public key

nonceTrialsPerByte number

Difficulty parameter of the sender (present only if sender's address version >= 3)

payloadLengthExtraBytes number

Difficulty parameter of the sender (present only if sender's address version >= 3)

encoding number

Message encoding

message string | Buffer

Message string for TRIVIAL and SIMPLE encodings or unparsed buffer data for other encodings

subject string <optional>

Subject string for SIMPLE encoding

signature Buffer

Signature of the message

length number

Real data length

Source: