• This repository has been archived on 13/Jun/2023
  • Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    Swift
  • License
    Other
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Parse LiveQuery Client for iOS/OS X.

Parse LiveQuery Client for iOS/OSX


⚠️ The LiveQuery feature has been added as a module to the Parse Apple SDK. This repository is archived and will no longer receive any updates.


Platforms Carthage compatible Podspec License ci release Build Status Join The Conversation Backers on Open Collective Sponsors on Open Collective Twitter Follow

PFQuery is one of the key concepts for Parse. It allows you to retrieve PFObjects by specifying some conditions, making it easy to build apps such as a dashboard, a todo list or even some strategy games. However, PFQuery is based on a pull model, which is not suitable for apps that need real-time support.

Suppose you are building an app that allows multiple users to edit the same file at the same time. PFQuery would not be an ideal tool since you can not know when to query from the server to get the updates.

To solve this problem, we introduce Parse LiveQuery. This tool allows you to subscribe to a PFQuery you are interested in. Once subscribed, the server will notify clients whenever a PFObject that matches the PFQuery is created or updated, in real-time.

Setup Server

Parse LiveQuery contains two parts, the LiveQuery server and the LiveQuery clients. In order to use live queries, you need to set up both of them.

The easiest way to setup the LiveQuery server is to make it run with the Open Source Parse Server.

Install Client

Cocoapods

You can install the LiveQuery client via including it in your Podfile:

pod 'ParseLiveQuery'

Use Client

The LiveQuery client interface is based around the concept of Subscriptions. You can register any PFQuery for live updates from the associated live query server, by simply calling subscribe() on a query:

let myQuery = Message.query()!.where(....)
let subscription: Subscription<Message> = Client.shared.subscribe(myQuery)

Where Message is a registered subclass of PFObject.

Once you've subscribed to a query, you can handle events on them, like so:

subscription.handleEvent { query, event in
    // Handle event
}

You can also handle a single type of event, if that's all you're interested in:

// Note it's handle(), not handleEvent()
subscription.handle(Event.created) { query, object in
    // Called whenever an object was created
}

By default, it will print the logs from WebSocket / WebSocketDelegate. You can turn it off:

Client.shared.shouldPrintWebSocketLog = false

You can also enable socket trace messages for all sent and received strings. By default, these trace messages are disabled.

Client.shared.shouldPrintWebSocketTrace = true

Handling errors is and other events is similar, take a look at the Subscription class for more information.

Advanced Usage

You are not limited to a single Live Query Client - you can create your own instances of Client to manually control things like reconnecting, server URLs, and more.

How Do I Contribute?

We want to make contributing to this project as easy and transparent as possible. Please refer to the Contribution Guidelines.


As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.

More Repositories

1

parse-server

Parse Server for Node.js / Express
JavaScript
20,806
star
2

parse-dashboard

A dashboard for managing Parse Server
JavaScript
3,738
star
3

Parse-SDK-iOS-OSX

The Apple SDK for Parse Platform (iOS, macOS, watchOS, tvOS)
Objective-C
2,809
star
4

parse-server-example

Example of Parse Server using the express framework.
JavaScript
1,883
star
5

Parse-SDK-Android

The Android SDK for Parse Platform
Java
1,879
star
6

Parse-SDK-JS

The JavaScript SDK for Parse Platform
JavaScript
1,317
star
7

ParseReact

Seamlessly bring Parse data into your React applications.
JavaScript
1,296
star
8

ParseUI-iOS

A collection of a handy user interface components to be used with the Parse iOS SDK.
Objective-C
934
star
9

parse-php-sdk

The PHP SDK for Parse Platform
PHP
811
star
10

ParseUI-Android

ParseUI contains user interface libraries for building apps with the Parse Android SDK.
Java
592
star
11

Parse-SDK-Flutter

The Dart/Flutter SDK for Parse Platform
Dart
575
star
12

Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
C#
322
star
13

docs

Parse Platform docs
SCSS
313
star
14

Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
Swift
302
star
15

parse-embedded-sdks

The Embedded SDKs for the Parse Platform
C
246
star
16

parse-cli

Go
118
star
17

ParseFacebookUtils-iOS

A set of utilities to integrate Facebook with the Parse iOS/tvOS SDK.
Objective-C
92
star
18

parse-server-push-adapter

A push notification adapter for Parse Server
JavaScript
87
star
19

ParseLiveQuery-Android

Parse LiveQuery client for Android.
Java
84
star
20

parse-server-simple-mailgun-adapter

Used to send Parse Server password reset and email verification emails though Mailgun
JavaScript
83
star
21

parse-server-s3-adapter

AWS S3 file storage adapter for Parse Server
JavaScript
80
star
22

parse-react

[EXPERIMENTAL] React, React Native, and React with SSR (e.g. Next.js) packages to interact with Parse Server backend
TypeScript
69
star
23

Parse-SDK-Arduino

The Arduino SDK for the Parse Platform
C++
68
star
24

ParseFacebookUtils-Android

A utility library to authenticate ParseUsers with the Facebook SDK
Java
53
star
25

ParseTwitterUtils-iOS

A set of utilities to integrate Twitter with the Parse iOS SDK.
Objective-C
46
star
26

parse-server-fs-adapter

parse-server file system storage adapter
JavaScript
42
star
27

ParseInterceptors-Android

Parse Network Interceptor Debugging
Java
37
star
28

parse-blockchain

Blockchain (Ethereum) dApps development made easy with Parse Server (alpha)
TypeScript
37
star
29

ParseTwitterUtils-Android

A utility library to authenticate ParseUsers with Twitter
Java
36
star
30

parse-facebook-user-session

A Cloud Code module to facilitate logging into an express website with Facebook.
JavaScript
36
star
31

parse-server-gcs-adapter

parse-server adapter for Google Cloud Storage
JavaScript
29
star
32

parse-server-api-mail-adapter

API Mail Adapter for Parse Server
JavaScript
27
star
33

benchmark

Parse Server Continuous Benchmark
JavaScript
24
star
34

xctoolchain-archive

Common configuration files and scripts that are used to build our SDKs with Xcode.
Ruby
22
star
35

blog

Parse Community Blog
SCSS
18
star
36

parse-server-sqs-mq-adapter

Spread work queue accross cluster of parse servers using SQS
JavaScript
17
star
37

parse-community.github.io

Parse Platform GitHub Pages
SCSS
10
star
38

relay-examples

Parse-Server GraphQL Relay Todo
JavaScript
10
star
39

Governance

Details about the leadership & decision making process for the Parse Community
10
star
40

parse-server-conformance-tests

Conformance tests for parse-server adapters
JavaScript
7
star
41

parse-community-peril

Peril for the parse-community
TypeScript
6
star
42

.github

Default community health files for the Parse Community
4
star
43

release-automation-playground

A playground repo to experiment with release automation.
2
star
44

docs-tutorial-todoapp

A tutorial for developing a ToDo app with Parse Platform
1
star