Interface ISseEventStreamStore
- Namespace
- ModelContextProtocol.Server
- Assembly
- ModelContextProtocol.Core.dll
Provides storage and retrieval of SSE event streams, enabling resumability and redelivery of events.
public interface ISseEventStreamStore
Methods
CreateStreamAsync(SseEventStreamOptions, CancellationToken)
Creates a new SSE event stream with the specified options.
ValueTask<ISseEventStreamWriter> CreateStreamAsync(SseEventStreamOptions options, CancellationToken cancellationToken = default)
Parameters
optionsSseEventStreamOptionsThe configuration options for the new stream.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- ValueTask<ISseEventStreamWriter>
A writer for the newly created event stream.
GetStreamReaderAsync(string, CancellationToken)
Gets a reader for an existing event stream based on the last event ID.
ValueTask<ISseEventStreamReader?> GetStreamReaderAsync(string lastEventId, CancellationToken cancellationToken = default)
Parameters
lastEventIdstringThe ID of the last event received by the client, used to resume from that point.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- ValueTask<ISseEventStreamReader>
A reader for the event stream, or
nullif no matching stream is found.