diff --git a/gen/KubernetesWatchGenerator/IKubernetes.Watch.cs.template b/gen/KubernetesWatchGenerator/IKubernetes.Watch.cs.template
index 06fe199..e174234 100644
--- a/gen/KubernetesWatchGenerator/IKubernetes.Watch.cs.template
+++ b/gen/KubernetesWatchGenerator/IKubernetes.Watch.cs.template
@@ -35,6 +35,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -55,6 +58,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
{{/.}}
diff --git a/gen/KubernetesWatchGenerator/Kubernetes.Watch.cs.template b/gen/KubernetesWatchGenerator/Kubernetes.Watch.cs.template
index 37620e2..bb356e2 100644
--- a/gen/KubernetesWatchGenerator/Kubernetes.Watch.cs.template
+++ b/gen/KubernetesWatchGenerator/Kubernetes.Watch.cs.template
@@ -24,10 +24,11 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken))
{
string path = $"{{GetPathExpression .}}";
- return WatchObjectAsync<{{GetClassName operation}}>(path: path, @continue: @continue, fieldSelector: fieldSelector, includeUninitialized: includeUninitialized, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, cancellationToken: cancellationToken);
+ return WatchObjectAsync<{{GetClassName operation}}>(path: path, @continue: @continue, fieldSelector: fieldSelector, includeUninitialized: includeUninitialized, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
}
{{/.}}
diff --git a/src/KubernetesClient/IKubernetes.Watch.cs b/src/KubernetesClient/IKubernetes.Watch.cs
index 890d595..77f6536 100644
--- a/src/KubernetesClient/IKubernetes.Watch.cs
+++ b/src/KubernetesClient/IKubernetes.Watch.cs
@@ -45,12 +45,15 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
///
/// A which represents the asynchronous operation, and returns a new watcher.
///
- Task> WatchObjectAsync(string path, string @continue = null, string fieldSelector = null, bool? includeUninitialized = null, string labelSelector = null, int? limit = null, bool? pretty = null, int? timeoutSeconds = null, string resourceVersion = null, Dictionary> customHeaders = null, Action onEvent = null, Action onError = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> WatchObjectAsync(string path, string @continue = null, string fieldSelector = null, bool? includeUninitialized = null, string labelSelector = null, int? limit = null, bool? pretty = null, int? timeoutSeconds = null, string resourceVersion = null, Dictionary> customHeaders = null, Action onEvent = null, Action onError = null, Action onClosed = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/src/KubernetesClient/Kubernetes.Watch.cs b/src/KubernetesClient/Kubernetes.Watch.cs
index ed824d0..9ecf56e 100644
--- a/src/KubernetesClient/Kubernetes.Watch.cs
+++ b/src/KubernetesClient/Kubernetes.Watch.cs
@@ -13,7 +13,7 @@ namespace k8s
public partial class Kubernetes
{
///
- public async Task> WatchObjectAsync(string path, string @continue = null, string fieldSelector = null, bool? includeUninitialized = null, string labelSelector = null, int? limit = null, bool? pretty = null, int? timeoutSeconds = null, string resourceVersion = null, Dictionary> customHeaders = null, Action onEvent = null, Action onError = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> WatchObjectAsync(string path, string @continue = null, string fieldSelector = null, bool? includeUninitialized = null, string labelSelector = null, int? limit = null, bool? pretty = null, int? timeoutSeconds = null, string resourceVersion = null, Dictionary> customHeaders = null, Action onEvent = null, Action onError = null, Action onClosed = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -152,7 +152,7 @@ namespace k8s
var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
StreamReader reader = new StreamReader(stream);
- return new Watcher(reader, onEvent, onError);
+ return new Watcher(reader, onEvent, onError, onClosed);
}
}
}
diff --git a/src/KubernetesClient/Watcher.cs b/src/KubernetesClient/Watcher.cs
index 9d44ac6..18fcc9e 100644
--- a/src/KubernetesClient/Watcher.cs
+++ b/src/KubernetesClient/Watcher.cs
@@ -29,68 +29,36 @@ namespace k8s
public bool Watching { get; private set; }
private readonly CancellationTokenSource _cts;
- private readonly StreamReader _streamReader;
-
- public Watcher(StreamReader streamReader, Action onEvent, Action onError)
+ private readonly StreamReader _streamReader;
+ private readonly Task _watcherLoop;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// A from which to read the events.
+ ///
+ ///
+ /// The action to invoke when the server sends a new event.
+ ///
+ ///
+ /// The action to invoke when an error occurs.
+ ///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
+ public Watcher(StreamReader streamReader, Action onEvent, Action onError, Action onClosed = null)
{
_streamReader = streamReader;
OnEvent += onEvent;
- OnError += onError;
+ OnError += onError;
+ OnClosed += onClosed;
- _cts = new CancellationTokenSource();
-
- var token = _cts.Token;
-
- Task.Run(async () =>
- {
- try
- {
- Watching = true;
-
- while (!streamReader.EndOfStream)
- {
- if (token.IsCancellationRequested)
- {
- return;
- }
-
- var line = await streamReader.ReadLineAsync();
-
- try
- {
- var genericEvent = SafeJsonConvert.DeserializeObject.WatchEvent>(line);
-
- if (genericEvent.Object.Kind == "Status")
- {
- var statusEvent = SafeJsonConvert.DeserializeObject.WatchEvent>(line);
- var exception = new KubernetesException(statusEvent.Object);
- this.OnError?.Invoke(exception);
- }
- else
- {
- var @event = SafeJsonConvert.DeserializeObject.WatchEvent>(line);
- this.OnEvent?.Invoke(@event.Type, @event.Object);
- }
- }
- catch (Exception e)
- {
- // error if deserialized failed or onevent throws
- OnError?.Invoke(e);
- }
- }
- }
- catch (Exception e)
- {
- // error when transport error, IOException ect
- OnError?.Invoke(e);
- }
- finally
- {
- Watching = false;
- }
- }, token);
+ _cts = new CancellationTokenSource();
+ _watcherLoop = this.WatcherLoop(_cts.Token);
}
-
+
+ ///
public void Dispose()
{
_cts.Cancel();
@@ -105,13 +73,71 @@ namespace k8s
///
/// add/remove callbacks when any exception was caught during watching
///
- public event Action OnError;
+ public event Action OnError;
+
+ ///
+ /// The event which is raised when the server closes th econnection.
+ ///
+ public event Action OnClosed;
public class WatchEvent
{
public WatchEventType Type { get; set; }
public T Object { get; set; }
+ }
+
+ private async Task WatcherLoop(CancellationToken cancellationToken)
+ {
+ // Make sure we run async
+ await Task.Yield();
+
+ try
+ {
+ Watching = true;
+ string line;
+
+ // ReadLineAsync will return null when we've reached the end of the stream.
+ while ((line = await this._streamReader.ReadLineAsync().ConfigureAwait(false)) != null)
+ {
+ if (cancellationToken.IsCancellationRequested)
+ {
+ return;
+ }
+
+ try
+ {
+ var genericEvent = SafeJsonConvert.DeserializeObject.WatchEvent>(line);
+
+ if (genericEvent.Object.Kind == "Status")
+ {
+ var statusEvent = SafeJsonConvert.DeserializeObject.WatchEvent>(line);
+ var exception = new KubernetesException(statusEvent.Object);
+ this.OnError?.Invoke(exception);
+ }
+ else
+ {
+ var @event = SafeJsonConvert.DeserializeObject.WatchEvent>(line);
+ this.OnEvent?.Invoke(@event.Type, @event.Object);
+ }
+ }
+ catch (Exception e)
+ {
+ // error if deserialized failed or onevent throws
+ OnError?.Invoke(e);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // error when transport error, IOException ect
+ OnError?.Invoke(e);
+ }
+ finally
+ {
+ Watching = false;
+ OnClosed?.Invoke();
+ }
}
}
@@ -123,18 +149,22 @@ namespace k8s
/// type of the event object
/// the api response
/// a callback when any event raised from api server
- /// a callbak when any exception was caught during watching
+ /// a callbak when any exception was caught during watching
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
/// a watch object
public static Watcher Watch(this HttpOperationResponse response,
Action onEvent,
- Action onError = null)
+ Action onError = null,
+ Action onClosed = null)
{
if (!(response.Response.Content is WatcherDelegatingHandler.LineSeparatedHttpContent content))
{
throw new KubernetesClientException("not a watchable request or failed response");
}
- return new Watcher(content.StreamReader, onEvent, onError);
+ return new Watcher(content.StreamReader, onEvent, onError, onClosed);
}
///
@@ -143,13 +173,17 @@ namespace k8s
/// type of the event object
/// the api response
/// a callback when any event raised from api server
- /// a callbak when any exception was caught during watching
+ /// a callbak when any exception was caught during watching
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
/// a watch object
public static Watcher Watch(this HttpOperationResponse response,
Action onEvent,
- Action onError = null)
+ Action onError = null,
+ Action onClosed = null)
{
- return Watch((HttpOperationResponse) response, onEvent, onError);
+ return Watch((HttpOperationResponse)response, onEvent, onError, onClosed);
}
}
}
diff --git a/src/KubernetesClient/generated/IKubernetes.Watch.cs b/src/KubernetesClient/generated/IKubernetes.Watch.cs
index 0f009be..0bbba2f 100644
--- a/src/KubernetesClient/generated/IKubernetes.Watch.cs
+++ b/src/KubernetesClient/generated/IKubernetes.Watch.cs
@@ -55,6 +55,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -76,6 +79,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -125,6 +129,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -146,6 +153,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -195,6 +203,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -216,6 +227,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -265,6 +277,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -286,6 +301,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -335,6 +351,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -356,6 +375,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -405,6 +425,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -426,6 +449,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -475,6 +499,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -496,6 +523,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -545,6 +573,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -566,6 +597,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -615,6 +647,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -636,6 +671,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -685,6 +721,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -706,6 +745,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -755,6 +795,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -776,6 +819,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -825,6 +869,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -846,6 +893,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -892,6 +940,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -912,6 +963,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -958,6 +1010,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -978,6 +1033,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1024,6 +1080,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1044,6 +1103,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1090,6 +1150,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1110,6 +1173,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1156,6 +1220,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1176,6 +1243,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1222,6 +1290,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1242,6 +1313,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1288,6 +1360,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1308,6 +1383,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1354,6 +1430,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1374,6 +1453,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1420,6 +1500,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1440,6 +1523,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1489,6 +1573,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1510,6 +1597,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1559,6 +1647,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1580,6 +1671,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1629,6 +1721,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1650,6 +1745,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1699,6 +1795,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1720,6 +1819,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1769,6 +1869,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1790,6 +1893,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1839,6 +1943,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1860,6 +1967,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1909,6 +2017,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -1930,6 +2041,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -1979,6 +2091,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2000,6 +2115,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2049,6 +2165,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2070,6 +2189,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2119,6 +2239,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2140,6 +2263,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2189,6 +2313,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2210,6 +2337,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2259,6 +2387,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2280,6 +2411,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2329,6 +2461,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2350,6 +2485,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2399,6 +2535,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2420,6 +2559,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2469,6 +2609,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2490,6 +2633,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2539,6 +2683,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2560,6 +2707,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2606,6 +2754,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2626,6 +2777,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2675,6 +2827,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2696,6 +2851,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2745,6 +2901,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2766,6 +2925,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2815,6 +2975,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2836,6 +2999,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2885,6 +3049,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2906,6 +3073,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -2955,6 +3123,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -2976,6 +3147,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3025,6 +3197,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3046,6 +3221,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3092,6 +3268,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3112,6 +3291,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3158,6 +3338,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3178,6 +3361,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3227,6 +3411,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3248,6 +3435,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3297,6 +3485,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3318,6 +3509,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3364,6 +3556,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3384,6 +3579,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3430,6 +3626,9 @@ namespace k8s
///
/// The action to invoke when an error occurs.
///
+ ///
+ /// The action to invoke when the server closes the connection.
+ ///
///
/// A which can be used to cancel the asynchronous operation.
///
@@ -3450,6 +3649,7 @@ namespace k8s
Dictionary> customHeaders = null,
Action onEvent = null,
Action onError = null,
+ Action onClosed = null,
CancellationToken cancellationToken = default(CancellationToken));
///
@@ -3499,6 +3699,9 @@ namespace k8s
///