Streamable HTTP resumability + redelivery + SSE polling via server-side disconnect (#1077)

Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
Mackinnon Buck 2026-01-14 22:54:25 -08:00 • committed by GitHub
commit b8311756b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -82,4 +82,21 @@ public sealed class RequestContext<TParams>
/// including the method name, parameters, request ID, and associated transport and user information.
/// </remarks>
public JsonRpcRequest JsonRpcRequest { get; }
/// <summary>
/// Ends the current response and enables polling for updates from the server.
/// </summary>
/// <param name="retryInterval">The interval at which the client should poll for updates.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A <see cref="ValueTask"/> that completes when polling has been enabled.</returns>
/// <exception cref="InvalidOperationException">Thrown when the transport does not support polling.</exception>
public async ValueTask EnablePollingAsync(TimeSpan retryInterval, CancellationToken cancellationToken = default)
{
if (JsonRpcRequest.Context?.RelatedTransport is not StreamableHttpPostTransport transport)
{
throw new InvalidOperationException("Polling is only supported for Streamable HTTP transports.");
}
await transport.EnablePollingAsync(retryInterval, cancellationToken).ConfigureAwait(false);
}
}