Called when a value is emitted from the stream.
For message streams, this selects callback mode. Do not also iterate that stream.
Message delivery is acknowledged after this callback returns successfully.
Called when a value is emitted from the stream.
For message streams, this selects callback mode. Do not also iterate that stream.
Message delivery is acknowledged after this callback returns successfully.
fortryawait conversation in client.conversations.stream(type: .all) {
handleConversation(conversation)
}
By default, streamAll streams only conversations with a consent state of allowed or unknown.
We recommend streaming messages for allowed conversations only. This ensures that spammy conversations with a consent state of unknown don’t take up networking resources. This also ensures that unwanted spam messages aren’t stored in the user’s local database.
Important
The stream is infinite. Therefore, any looping construct used with the stream won’t terminate unless you explicitly initiate the termination. You can initiate the termination by breaking the loop or by making an external call to return.
When a stream registers a topic, it captures a fixed catch-up target. It delivers every retained envelope above the local cursor through that target, then continues with new envelopes. New publications do not move the target.
A topic is caught up only after the SDK safely processes the range through the target. To receive only live traffic, sync before starting the stream.
The Agent SDK wraps Node streams and emits events named for the content type. It also emits message, unknownMessage, conversation, group, dm, start, stop, and unhandledError. Its additional retry layer uses up to 10 attempts with exponential backoff from 1 second to 30 seconds.