Exchange

exchange~ Exchange

Interface for communicating with other Forsta devices. Payload Definition

Constructor

new Exchange()

Source:

Methods

(async) addMessageListener(callback)

Source:
Listen for new message events on pertaining to this exchange's thread.
Parameters:
Name Type Description
callback callback

(abstract, protected) decodePayload(payload)

Source:
Parameters:
Name Type Description
payload Object Version specific payload object.

(abstract, protected) encodePayload()

Source:

getAge() → {number}

Source:
Time this message spent waiting for delivery on the Signal server.
Returns:
Milliseconds
Type
number

(abstract) getAttachments() → (nullable) {Array.<Attachment>}

Source:
Returns:
Attachments for this message.
Type
Array.<Attachment>

(abstract) getBody(options)

Source:
Get the message body. E.g. the localized text for this message.
Parameters:
Name Type Description
options Object

(abstract) getDataProperty(key) → {Object}

Source:
Parameters:
Name Type Description
key string The data key to get.
Returns:
The natively typed value for this data property.
Type
Object

getExpiration() → {number}

Source:
Returns:
Expiration time for messages on this thread.
Type
number

getFlags() → {number}

Source:
Returns:
Signal flags associated with this message.
Type
number

(abstract) getMessageId() → {string}

Source:
Returns:
The UUID for this message.
Type
string

(abstract) getMessageRef() → (nullable) {string}

Source:
Returns:
The optional message reference. E.g. the UUID of a prior message that this message refers/replies to.
Type
string

(abstract) getMessageType() → {string}

Source:
Returns:
The message type.
Type
string

(abstract) getSender()

Source:

(abstract) getSenderDevice() → {number}

Source:
Returns:
device ID of sender.
Type
number

getSource() → {string}

Source:
Returns:
UUID for user that sent or is sending this message.
Type
string

getSourceDevice() → {number}

Source:
Returns:
device ID of source user.
Type
number

(abstract) getThreadExpression() → {string}

Source:
Returns:
The universal tag expression for this exchange's thread.
Type
string

(abstract) getThreadId() → {string}

Source:
Returns:
The UUID for this exhcange's thread.
Type
string

(abstract) getThreadTitle() → (nullable) {string}

Source:
Returns:
The optional thread title.
Type
string

(abstract) getThreadType() → {'converstaion'|'announcement'}

Source:
Returns:
The thread type for this message.
Type
'converstaion' | 'announcement'

getTimestamp() → {number}

Source:
Every message has a global and non-secret timestamp that is used to' cross reference things like read-receipts and session retransmits.
Returns:
Milliseconds since 1970.
Type
number

(abstract) getUserAgent() → {string}

Source:
Returns:
The device user agent string.
Type
string

(generator) recvMessages(options)

Source:
Generator for receiving new messages on this exchange's thread.
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Description
timeout number <optional>
Timeout in milliseconds

(async) removeMessageListener(callback)

Source:
Remove message event listener added by addMessageListener.
Parameters:
Name Type Description
callback callback

(async) send(options)

Source:
Send a message to this exchange's thread.
Parameters:
Name Type Description
options SendOptions All standard send options are supported plus...
Properties
Name Type Attributes Description
onlySender bool <optional>
Set to true if you want to send a message to only the original sender of this exchange object. Used for private replies to an individual regardless of the thread distribution.

setAge(value)

Source:
Parameters:
Name Type Description
value number Milliseconds this message spent waiting for delivery (set by server).

(abstract) setAttachments(value)

Source:
Parameters:
Name Type Description
value Array.<Attachment> Attachments array for this message.

(abstract) setBody(value, optionsopt)

Source:
Set the message body. E.g. the localized text for this message.
Parameters:
Name Type Attributes Description
value string The body contents. E.g. text or html.
options Object <optional>

(abstract) setDataProperty(key, value)

Source:
Parameters:
Name Type Description
key string The data key to set.
value Object The natively typed value for this data property.

setExpiration(value)

Source:
Parameters:
Name Type Description
value number Expiration time for messages on this thread.

setFlags(value)

Source:
Parameters:
Name Type Description
value number Signal flags associated with this message.

(abstract) setMessageId(value)

Source:
Parameters:
Name Type Description
value string UUID for this message.

(abstract) setMessageRef(value)

Source:
Parameters:
Name Type Description
value string Message UUID to reference. E.g. the replied to UUID.

(abstract) setMessageType(value)

Source:
Parameters:
Name Type Description
value string The message type. E.g. "content", "control", ...

(abstract) setSender(value)

Source:
Parameters:
Name Type Description
value string The sender's UUID.

(abstract) setSenderDevice(value)

Source:
Parameters:
Name Type Description
value number Device ID of sender.

setSource(UUID)

Source:
Parameters:
Name Type Description
UUID string of user sending this message.

setSourceDevice(value)

Source:
Parameters:
Name Type Description
value number Device ID of source user.

(abstract) setThreadExpression(value)

Source:
Parameters:
Name Type Description
value string The universal tag expression for this exchange's thread.

(abstract) setThreadId(value)

Source:
Parameters:
Name Type Description
value string The thread UUID for this exchange.

(abstract) setThreadTitle(valuenullable)

Source:
Parameters:
Name Type Attributes Description
value string <nullable>
Localized thread title text.

(abstract) setThreadType(value)

Source:
Parameters:
Name Type Description
value 'conversation' | 'announcement' The thread type for this exchange.

setTimestamp(value)

Source:
Parameters:
Name Type Description
value number Timestamp of this message in milliseconds since 1970.

(abstract) setUserAgent(value)

Source:
Parameters:
Name Type Description
value string The user agent string for this message.