Skip to content

Allow to run queries through LiveQueryClient (Parse Server issue #9086) #2114

Open
@messagenius-admin

Description

@messagenius-admin

It should be possible to run Queries through a LiveQueryClient, and/or to request query results along with LiveQuery subscription to enable syncing collections and subscribing to LiveQueries with a single WebSocket connection.

A Parse Server issue with detailed information has been created here: parse-community/parse-server#9086. However, this feature requires development on both client and server.

Possible Alternative 1:
Get query results leveraging the subscription

subscription.on('result', task => tasks[task.id] = task);
subscription.find(); // or subscription.first(); or getResults() or runQuery(), or any other naming that makes sense.

Possible Alternative 2:
Allow running any query from a LiveQueryClient. This potentially enables developers to run queries through WebSocket, detached from a subscription.

const client = new LiveQueryClient({ ... });
const querySubscription = client.querySubscribe(query);
querySubscription.on('result', task => tasks[task.id] = task);

Ideally, both alternatives 1 and 2 should be developed, with one serving as a shortcut for the other, similar to how currently a subscription can be run with or without an explicit liveQueryClient.

EDIT Apr 30:
Consider running all requests through WebSocket, including Queries, Saves, Cloud Functions, and all CRUD operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions