@get-advantage/advantage / utils/messaging
Module: utils/messaging
Variables
ADVANTAGE
• Const
ADVANTAGE: "ADVANTAGE"
Defined in
Functions
sendMessageAndAwaitResponse
▸ sendMessageAndAwaitResponse(message
, messageChannel
, timeout
): Promise
<AdvantageMessage
>
Sends a message and awaits a response.
Parameters
Name | Type | Description |
---|---|---|
message | Partial <AdvantageMessage > | The message to send. |
messageChannel | MessageChannel | The message channel to use for communication. |
timeout | number | The timeout in milliseconds. |
Returns
Promise
<AdvantageMessage
>
A promise that resolves with the response message.
Defined in
sendMessageAndOpenChannel
▸ sendMessageAndOpenChannel(message
, retryInterval?
, maxAttempts?
): Promise
<{ messageChannel
: MessageChannel
; reply
: AdvantageMessage
}>
Sends a message and opens a message channel to receive the reply.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
message | Partial <AdvantageMessage > | undefined | The message to send. |
retryInterval | number | 200 | The interval (in milliseconds) between retry attempts. Default is 100ms. |
maxAttempts | number | 25 | The maximum number of retry attempts. Default is 25. |
Returns
Promise
<{ messageChannel
: MessageChannel
; reply
: AdvantageMessage
}>
A promise that resolves with the reply and the message channel.