YB.ParseLiveQueryDotNet 2.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package YB.ParseLiveQueryDotNet --version 2.0.4                
NuGet\Install-Package YB.ParseLiveQueryDotNet -Version 2.0.4                
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="2.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YB.ParseLiveQueryDotNet --version 2.0.4                
#r "nuget: YB.ParseLiveQueryDotNet, 2.0.4"                
#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.
// Install YB.ParseLiveQueryDotNet as a Cake Addin
#addin nuget:?package=YB.ParseLiveQueryDotNet&version=2.0.4

// Install YB.ParseLiveQueryDotNet as a Cake Tool
#tool nuget:?package=YB.ParseLiveQueryDotNet&version=2.0.4                

Parse-Live-Query-Unofficial

Now on V2.0.4 ! 🚪

Changelog:

Major Bug Fix on base Parse SDK!

  • LogOut now works perfectly fine and doesn't crash app!

  • SignUpWithAsync() will now return the Signed up user's info to avoid Over querying.
  • Renamed some methods.
  • Fixed perhaps ALL previous UNITY crashes.

Before:

  • Added Support for .NET 5,6,7,8, 9 and .NET MAUI.
  • Replaced previous web client with System.Net.WebSockets.Client as I believe is better.
  • Replaced Subscriptions and callbacks with System.Reactive for better handling of events.
  • Added a YouTube video for a full walkthrough of the SDK.

Here is the full ReadMe;

Since I Updated this based on my MAUI Projects, I had to update my fork of Parse SDK to have MAUI support, thus

THIS is DEPENDENT on my ParseSDK fork.

(which is now merged so I lazily update the forked parse repo but I do!!)

What are Live Queries?

Glad you asked! So to put it VERY SIMPLE : Live Queries lets you build a RealTime Chat App in less than idk 25 lines of code? (Excluding UI ofc).

In "Long" it essentially opens a Websocket/caller-listener tunnel where WHATEVER changes done to the subscribed class/table(for sql folks), will reflect to ALL listening clients in "real time" (very very minimal delay. Like and Eye blink's delay!)

Example: You Create a Class/Table (for SQL folks) then tell the server "Whatever is done here TELL EVERYONE WHO NEEDS TO BE INFORMED ASAP ", then the client apps (your developed app) will subscribe to the EVENTUAL POSSIBILITIES of any change happening to your class/table records.

As such.

  1. Device A Subscribes to class/table "Comments" found in Server.
  2. Device B subscribes to "Comments" too.
  3. Device A → Server (A sends to server)
  4. Device A ← Server → Device B (Server sends back data to both devices ASSUMING THEY ARE ALLOWED TO VIEW THE CHANGES, you can configure this with ACL!)

I hope it's a OVERexplanation now haha! But if you any more specific questions, please shoot!

How To Use In addition to the docs over from the folks at ; For now:

STEP 0 (VERY IMPORTANT): MAKE SURE YOUR ENABLE LIVE QUERY ON THE CLASSES NEEDED.

I used Back4Apps for dev/testing so the 2 classes I needed were checked!

1. Download the project's source and add to your solution , your solution will look like (in the Git page)

2. You will have to initialize your ParseClient with your app's details

// Check for internet connection
if (Connectivity.NetworkAccess != NetworkAccess.Internet)
{
    Console.WriteLine("No Internet Connection: Unable to initialize ParseClient.");
    return false;
}

// Create ParseClient
ParseClient client = new ParseClient(new ServerConnectionData
{
    ApplicationID = APIKeys.ApplicationId, 
    ServerURI = APIKeys.ServerUri,
    Key = APIKeys.DotNetKEY, // Or use MASTERKEY

}
);
HostManifestData manifest = new HostManifestData() // Optional but I really recommend setting just to avoid potential crashes
{
    Version = "1.0.0",
    Identifier = "com.yvanbrunel.myMauiApp",
    Name = "myAppName",
};

client.Publicize(); // Best to use if you want to access ParseClient.Instance anywhere in the app.

3. Setup Live Queries

A subscription can be very easily handled as such I copied the code from my Sample Demo App Here;


    //I Will Just leave all this code in Docs because believe it or not, sometimes even I forget how to use my own lib :D
// Do not worry if you don't understand the Sample still, the demo app makes it make sense all together!
    void SetupLiveQuery()
    {
        try
        {
            var query = ParseClient.Instance.GetQuery("TestChat");
            var subscription = LiveClient.Subscribe(query);

            LiveClient.ConnectIfNeeded();

            // Rx event streams
            LiveClient.OnConnected
                .Subscribe(_ => Debug.WriteLine("LiveQuery connected."));
            LiveClient.OnDisconnected
                .Subscribe(info => Debug.WriteLine(info.userInitiated
                    ? "User disconnected."
                    : "Server disconnected."));
            LiveClient.OnError
                .Subscribe(ex => Debug.WriteLine("LQ Error: " + ex.Message));
            LiveClient.OnSubscribed
                .Subscribe(e => Debug.WriteLine("Subscribed to: " + e.requestId));

            // Handle object events (Create/Update/Delete)
            LiveClient.OnObjectEvent
                .Where(e => e.subscription == subscription)
                
                .Subscribe(e =>
                {
                    Debug.WriteLine($"Message before {Message?.Length}");
                    TestChat chat = new();
                    var objData = (e.objectDictionnary as Dictionary<string, object>);

                    switch (e.evt)
                    {
                        
                        case Subscription.Event.Enter:
                            Debug.WriteLine("entered");
                            break;
                        case Subscription.Event.Leave:
                            Debug.WriteLine("Left");
                            break;
                            case Subscription.Event.Create:
                            chat = ObjectMapper.MapFromDictionary<TestChat>(objData);
                            Messages.Add(chat);
                            break;
                            case Subscription.Event.Update:
                            chat = ObjectMapper.MapFromDictionary<TestChat>(objData);
                            var obj = Messages.FirstOrDefault(x => x.UniqueKey == chat.UniqueKey);
                            
                            Messages.RemoveAt(Messages.IndexOf(obj));
                            Messages.Add(chat);

                            break;
                            case Subscription.Event.Delete:
                            chat = ObjectMapper.MapFromDictionary<TestChat>(objData);
                            var objj = Messages.FirstOrDefault(x => x.UniqueKey == chat.UniqueKey);

                            Messages.RemoveAt(Messages.IndexOf(objj));
                            break;
                        default:
                            break;
                    }
                    Debug.WriteLine($"Message after {Message.Length}");
                    Debug.WriteLine($"Event {e.evt} on object {e.objectDictionnary.GetType()}");
                });

        }
        catch (Exception ex)
        {
            Debug.WriteLine("SetupLiveQuery Error: " + ex.Message);
        }
    }

If you need a connection listener, you can set a class as


That's it!
I'll be updating the SDK with any new features if any, The .NET SDK had no Equivalent but we do now AND with RX + LINQ! 
This is a simple "Port" with BUNCH OF Fixes from the Parse SDK itself, and some PRs from the forked repo (and except for unwanted crashes) and no security updates (if any, after Nov 27th 2024, when I prepared this release).
PRs are welcomed!


Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 73 12/21/2024
2.0.4 85 12/17/2024
2.0.3 75 12/13/2024
2.0.1 76 12/13/2024
1.0.0 86 12/5/2024

See detailed release notes in ReleaseNotes.md