SurrealDB WebSocket LIVE SELECT subscriptions versus HTTP REST live-change delivery
0 reputation · 25 Feb 2020, 16:19 UTC
0 reputation · 25 Feb 2020, 16:19 UTC
Determine whether SurrealDB can apply server-side filtering to real-time change notifications so that WebSocket and HTTP clients receive only actionable live-query events without alert noise.
SurrealDB supports LIVE SELECT and CHANGES over persistent WebSocket connections, while the HTTP REST interface is primarily request/response and is not the documented transport for persistent streaming subscriptions. SurrealQL WHERE clauses can scope the row set, but the platform does not advertise a separate alerting rule engine, deduplication, or debounce layer. Permission re-evaluation timing during streaming change events and delivery semantics such as ordering, exactly-once delivery, and resume-after-reconnect vary by server version and deployment.
Because behavior differs across SurrealDB versions, self-hosted builds, and SurrealDB Cloud, the exact version under consideration must be confirmed before relying on any filtering or delivery guarantee.
Can SurrealQL WHERE clauses reliably suppress non-matching change events for live queries over WebSocket? Does the HTTP REST endpoint surface the same filtered live-change stream, or must clients filter events after receipt? What version-specific delivery semantics govern reconnection and missed changes?
35775 reputation · 26 Feb 2020, 02:55 UTC
WebSocket LIVE SELECT with WHERE clauses is the supported path for server-side filtered live notifications. The WHERE clause is evaluated as part of the live query, so the server can suppress rows that never match or stop matching. HTTP REST does not reliably expose the same filtered streaming subscription in any documented build; it remains primarily request/response. Delivery guarantees (ordering, exactly-once, resume-after-reconnect) are version-specific and not uniformly guaranteed across self-hosted, Cloud, or version lines.
LIVE SELECT subscriptions.LIVE SELECT ... WHERE ... query maintains a server-side result set; CREATE/UPDATE/DELETE events translate into add/update/remove notifications for matching rows.LIVE SELECT and reconcile state on reconnect.LIVE SELECT * FROM table WHERE condition.Exact SurrealDB version and deployment (self-hosted version tag, Cloud tier, or custom build). This determines which of the above behaviors apply and whether any HTTP live endpoint exists.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 25 Feb 2020, 20:58 UTC
SurrealQL WHERE clauses perform server-side filtering on LIVE SELECT subscriptions over WebSocket, ensuring only matching changes reach clients. This reduces alert noise versus receiving all row-level events. HTTP REST /query and /sql support one-shot CHANGES TABLE ... SINCE queries but not a persistent filtered stream. WebSocket delivery is ordered per connection but does not guarantee exactly-once semantics; duplicates can appear during reconnection. On reconnection, clients must re-issue LIVE SELECT; missed changes are not auto-replayed unless the client tracks the last versionstamp and issues CHANGES ... SINCE to catch up. Permission checks are evaluated at subscription time and are not re-evaluated for individual events; a privilege revocation requires dropping and re-establishing the subscription. Behavior varies between self-hosted and SurrealDB Cloud, and across 1.x and 2.x+ series. Confirm the exact server version and validate filter behavior with a controlled change stream before relying on live notifications.