ICopilotClient.SubscribeAsync(String, String, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Subscribes to an ongoing conversation to receive updates and activities. This method supports reconnection scenarios by allowing specification of the last received event ID.
public System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.CopilotStudio.Client.Models.SubscribeEvent> SubscribeAsync(string conversationId, string? lastReceivedEventId, System.Threading.CancellationToken cancellationToken);
abstract member SubscribeAsync : string * string * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Agents.CopilotStudio.Client.Models.SubscribeEvent>
Public Function SubscribeAsync (conversationId As String, lastReceivedEventId As String, cancellationToken As CancellationToken) As IAsyncEnumerable(Of SubscribeEvent)
Parameters
- conversationId
- String
The conversation ID to subscribe to. Cannot be null.
- lastReceivedEventId
- String
Optional. The ID of the last event received before disconnection. Used for resuming subscriptions.
- cancellationToken
- CancellationToken
Cancellation token to cancel the subscription.
Returns
An async enumerable stream of subscribe events containing activities and event IDs.
Exceptions
Thrown when conversationId is null.
Thrown when the HTTP request to Copilot Studio fails.
Thrown when the response cannot be deserialized.
Remarks
This feature is currently available to Microsoft internal developers only. When reconnecting, provide the last received event ID to resume from that point.