YB.ParseLiveQueryDotNet
3.5.1
dotnet add package YB.ParseLiveQueryDotNet --version 3.5.1
NuGet\Install-Package YB.ParseLiveQueryDotNet -Version 3.5.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YB.ParseLiveQueryDotNet" Version="3.5.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YB.ParseLiveQueryDotNet" Version="3.5.1" />
<PackageReference Include="YB.ParseLiveQueryDotNet" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YB.ParseLiveQueryDotNet --version 3.5.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: YB.ParseLiveQueryDotNet, 3.5.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package YB.ParseLiveQueryDotNet@3.5.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YB.ParseLiveQueryDotNet&version=3.5.1
#tool nuget:?package=YB.ParseLiveQueryDotNet&version=3.5.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
This is a major release that includes a significant refactor of the underlying WebSocket engine, modernization of the public API to even more async, and the introduction of several key features to improve resilience and developer experience.
💥 BREAKING CHANGES
This version introduces several breaking changes to the public API to align with modern .NET Task-based Asynchronous Patterns (TAP) and improve overall robustness.
- Async Public API: All major lifecycle and communication methods are now fully asynchronous and support
CancellationToken
.IWebSocketClient.Open()
is nowTask OpenAsync(CancellationToken cancellationToken = default)
.IWebSocketClient.Close()
is nowTask CloseAsync(WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken = default)
.IWebSocketClient.Send(string message)
is nowTask SendAsync(string message, CancellationToken cancellationToken = default)
.
- Client Lifecycle Management: The client's connection lifecycle is now managed explicitly.
- The implicit
ConnectIfNeeded()
andReconnect()
methods have been replaced by an explicitStart()
method to initiate the connection and enable auto-reconnection. - The
Disconnect()
method has been replaced byTask StopAsync()
to cleanly shut down the client, disconnect, and disable auto-reconnection.
- The implicit
WebSocketClientFactory
Signature Change: The delegate signature has been simplified. ThebufferSize
parameter has been removed as it is now managed internally by theWebSocketClient
.- Old:
delegate IWebSocketClient WebSocketClientFactory(Uri hostUri, IWebSocketClientCallback cb, int bufferSize)
- New:
delegate IWebSocketClient WebSocketClientFactory(Uri hostUri, IWebSocketClientCallback cb)
- Old:
- Event Handling Rerouted: The global
ParseLiveQueryClient.OnObjectEvent
observable has been removed. Object events are now routed directly to the specificSubscription<T>
instance that they belong to. This provides a more intuitive and type-safe way to handle events. IWebSocketClientCallback.OnClose()
Signature Change: TheOnClose()
method now provides detailed information about why the connection was closed.- Old:
void OnClose()
- New:
void OnClose(WebSocketCloseStatus? status, string description)
- Old:
OnDisconnected
Observable Change: TheOnDisconnected
observable now emits aDisconnectInfo
record, providing richer contextual information (e.g.,CloseStatus
,Reason
) instead of a simple tuple.
🚀 New Features
- Traditional C# Event Handlers: In addition to the existing
System.Reactive
(Rx) observables,Subscription<T>
now exposes traditional C# events (OnCreate
,OnUpdate
,OnDelete
,OnEnter
,OnLeave
) for a more familiar event-driven programming model. Extension methods (.On(...)
,.OnUpdate(...)
) have been added for easy attachment. - Async Disposal:
ParseLiveQueryClient
now implementsIAsyncDisposable
. You can now properly await its disposal usingawait using var client = new ParseLiveQueryClient();
. - Formal Connection State Machine: The client now exposes a
LiveQueryConnectionState
enum (Disconnected
,Connecting
,Connected
,Reconnecting
,Failed
) and anOnConnectionStateChanged
observable, providing transparent insight into the client's current status. - Binary Message Support (Preview): The
IWebSocketClient
interface now includes anIObservable<ReadOnlyMemory<byte>> BinaryMessages
stream, laying the groundwork for handling binary data from the server. - Detailed Disconnect Information: The
OnDisconnected
observable now provides aDisconnectInfo
record, which includes the close status and reason, and a flag indicating if the disconnect was user-initiated.
✨ Improvements & Refinements
- WebSocket Engine Overhaul: The
WebSocketClient
has been completely rewritten for superior stability and performance.- Connection Resilience: The connection logic is now managed in a dedicated
ConnectWithRetryAsync
loop with exponential backoff, making it far more resilient to transient network failures. - Centralized State Management: A new
UpdateState
method ensures that all state transitions are managed cleanly and broadcast to observers. - Graceful Shutdown: A new
CloseInternalAsync
method centralizes shutdown logic, ensuringCancellationTokenSource
s are cancelled, sockets are closed gracefully, and resources are disposed of correctly, preventing race conditions. - Performance: The receive loop now uses
ArrayPool<byte>.Shared
andMemoryStream
to significantly reduce memory allocations and GC pressure during message processing. - Native Keep-Alive: The manual ping/pong mechanism has been replaced by leveraging the native
ClientWebSocket.Options.KeepAliveInterval
, simplifying the implementation and reducing network chatter.
- Connection Resilience: The connection logic is now managed in a dedicated
- Thread Safety: The core
ParseLiveQueryClient
has improved thread safety by introducing a_stateLock
for managing its connection state. - Error Propagation: The
TaskQueueWrapper
now correctly propagates exceptions fromEnqueueOnSuccess
tasks, preventing them from being silently swallowed. - Code Organization: The utility
ObjectMapper
has been removed from theParseLiveQueryClient.cs
file, improving separation of concerns.
🐛 Bug Fixes
- Addressed Reconnection Race Conditions: The previous architecture, where reconnection was attempted from within the
ReceiveLoopAsync
, could lead to race conditions and an unstable state. The redesigned connection logic inWebSocketClient
completely resolves this. - Corrected Exception Handling in Task Queue: Ensured that exceptions thrown during the execution of tasks within
EnqueueOnSuccess
are no longer suppressed and are properly propagated as anInvalidOperationException
. - Improved
Dispose
Pattern: TheDispose
logic inWebSocketClient
is now more robust, ensuring all reactive subjects are completed and all resources, including theClientWebSocket
andCancellationTokenSource
s, are properly cleaned up.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- System.Reactive (>= 6.0.1)
-
net7.0
- System.Reactive (>= 6.0.1)
-
net8.0
- System.Reactive (>= 6.0.1)
-
net9.0
- System.Reactive (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See detailed release notes in ReleaseNotes.md