2.45.0
(feat): Add InjectTestMessage internal method to generated WebSocket client classes.
This allows unit tests to simulate incoming WebSocket messages by injecting raw
JSON strings through the normal OnTextMessage pipeline without requiring a real
WebSocket connection. The method is marked internal so it is only accessible
via [InternalsVisibleTo] in test projects, keeping the public API surface clean.
2.44.0
(feat): Add queued sending via Channel<T> to the WebSocket connection layer. Two
unbounded channels (text and binary) are drained by dedicated background tasks
started alongside the connection. The non-blocking Send(string) and Send(byte[])
methods return bool indicating whether the message was queued, while the existing
SendInstant async-per-send path remains unchanged. Queues are completed in Dispose
before cancellation tokens are signalled. Drain loop errors are surfaced through the
ExceptionOccurred event.
2.43.0
(feat): Add per-message deflate compression support (RFC 7692) for WebSocket connections.
A new EnableCompression option on the generated WebSocket Options class enables
WebSocketDeflateOptions via ClientWebSocketOptions.DangerousDeflateOptions.
This can significantly reduce bandwidth for text-heavy (JSON) WebSocket APIs.
Warning: Do not use compression when sending data containing secrets
(CRIME/BREACH vulnerability).
See https://learn.microsoft.com/dotnet/api/system.net.websockets.clientwebsocketoptions.dangerousdeflateoptions
for details.
2.42.0
(feat): Add support for HTTP/2 WebSockets via SocketsHttpHandler. A new HttpInvoker
property on the WebSocket Options class allows passing an HttpMessageInvoker to
enable multiplexing multiple WebSocket streams over a single TCP connection. When
set, the connection factory configures HttpVersion.Version20 and uses the
ConnectAsync(Uri, HttpMessageInvoker, CancellationToken) overload on .NET 7+.
On older targets the invoker is ignored and the standard connect path is used.
2.41.0
(feat): Add ConnectTimeout property to WebSocketConnection and WebSocketClient with a
default of 5 seconds. The connection factory call in StartClient now uses a linked
CancellationTokenSource with CancelAfter(ConnectTimeout), preventing indefinite
hangs when the server is unresponsive.
2.40.0
(feat): Configure PING/PONG keep-alive on ClientWebSocket. The default connection factory
now sets KeepAliveInterval (default: 30 s) and, on .NET 9+, KeepAliveTimeout
(default: 20 s) to enable the PING/PONG keep-alive strategy that detects unresponsive
servers at the transport level. Both values are exposed as public properties on
WebSocketConnection for caller customization.
2.38.2
(fix): Add using declaration to JsonDocument in WebSocket OnTextMessage handler.
JsonDocument implements IDisposable and holds pooled memory buffers; without
disposal, high message throughput causes memory pressure. The generated code now
emits using var json = await JsonSerializer.DeserializeAsync<JsonDocument>(stream);
so the document is disposed when the method returns.