Module: Parse::LiveQuery
- Defined in:
- lib/parse/live_query.rb,
lib/parse/live_query.rb,
lib/parse/live_query/event.rb,
lib/parse/live_query/client.rb,
lib/parse/live_query/logging.rb,
lib/parse/live_query/event_queue.rb,
lib/parse/live_query/subscription.rb,
lib/parse/live_query/configuration.rb,
lib/parse/live_query/health_monitor.rb,
lib/parse/live_query/circuit_breaker.rb
Overview
LiveQuery requires an explicit opt-in before any subscription will open a network connection. This is a safety gate (operator must consciously enable the WebSocket egress surface), not a stability warning. Set the toggle once at boot:
Parse.live_query_enabled = true
LiveQuery provides real-time data subscriptions for reactive applications. It uses WebSockets to receive push notifications when data changes on the server. Stable since Parse Stack 3.0.0.
Defined Under Namespace
Modules: Logging Classes: AuthenticationError, CircuitBreaker, Client, Configuration, ConnectionError, Error, Event, EventQueue, EventQueueFullError, HealthMonitor, NotEnabledError, Subscription, SubscriptionError
Constant Summary collapse
- EVENTS =
Default LiveQuery events
%i[create update delete enter leave].freeze
Class Attribute Summary collapse
-
.default_client ⇒ Parse::LiveQuery::Client
The default LiveQuery client.
Class Method Summary collapse
-
.available? ⇒ Boolean
Check if LiveQuery is configured and available.
-
.client ⇒ Parse::LiveQuery::Client
Get or create the default LiveQuery client.
-
.config ⇒ Parse::LiveQuery::Configuration
Get the LiveQuery configuration object.
-
.configuration ⇒ Hash
deprecated
Deprecated.
Use configure block instead
-
.configure {|config| ... } ⇒ Configuration
Configure LiveQuery settings using a block.
-
.enabled? ⇒ Boolean
Check if LiveQuery feature is enabled.
-
.ensure_enabled! ⇒ Object
Ensure LiveQuery is enabled, raising an error if not.
-
.reset! ⇒ Object
Reset the default client (closes connection and clears instance).
Class Attribute Details
.default_client ⇒ Parse::LiveQuery::Client
Returns the default LiveQuery client.
91 92 93 |
# File 'lib/parse/live_query.rb', line 91 def default_client @default_client end |
Class Method Details
.available? ⇒ Boolean
Check if LiveQuery is configured and available
122 123 124 |
# File 'lib/parse/live_query.rb', line 122 def available? !!config.url end |
.client ⇒ Parse::LiveQuery::Client
Get or create the default LiveQuery client. Uses the configuration from Parse.setup if available.
109 110 111 112 |
# File 'lib/parse/live_query.rb', line 109 def client ensure_enabled! @default_client ||= Client.new end |
.config ⇒ Parse::LiveQuery::Configuration
Get the LiveQuery configuration object
128 129 130 |
# File 'lib/parse/live_query.rb', line 128 def config @config ||= Configuration.new end |
.configuration ⇒ Hash
Use configure block instead
Legacy configuration method for backward compatibility
158 159 160 161 162 163 164 165 |
# File 'lib/parse/live_query.rb', line 158 def configuration { url: config.url, application_id: config.application_id, client_key: config.client_key, master_key: config.master_key, } end |
.configure {|config| ... } ⇒ Configuration
Configure LiveQuery settings using a block
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/parse/live_query.rb', line 142 def configure yield config if block_given? # Sync logging settings if config.logging_enabled Logging.enabled = true Logging.log_level = config.log_level Logging.logger = config.logger if config.logger end config end |
.enabled? ⇒ Boolean
Check if LiveQuery feature is enabled
95 96 97 |
# File 'lib/parse/live_query.rb', line 95 def enabled? Parse.live_query_enabled? end |
.ensure_enabled! ⇒ Object
Ensure LiveQuery is enabled, raising an error if not
101 102 103 |
# File 'lib/parse/live_query.rb', line 101 def ensure_enabled! raise NotEnabledError unless enabled? end |
.reset! ⇒ Object
Reset the default client (closes connection and clears instance)
115 116 117 118 |
# File 'lib/parse/live_query.rb', line 115 def reset! @default_client&.close @default_client = nil end |