Add ability for client to resume session (#1029)
This commit is contained in:
parent
979befdd14
commit
7f25ae9d2a
1 changed files with 433 additions and 3 deletions
|
|
@ -72,6 +72,11 @@ public sealed class HttpClientTransport : IClientTransport, IAsyncDisposable
|
|||
/// <inheritdoc />
|
||||
public async Task<ITransport> ConnectAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (_options.KnownSessionId is not null && _options.TransportMode == HttpTransportMode.Sse)
|
||||
{
|
||||
throw new InvalidOperationException("SSE transport does not support resuming an existing session.");
|
||||
}
|
||||
|
||||
return _options.TransportMode switch
|
||||
{
|
||||
HttpTransportMode.AutoDetect => new AutoDetectingClientSessionTransport(Name, _options, _mcpHttpClient, _loggerFactory),
|
||||
|
|
|
|||
Loading…
Reference in a new issue