SyncStream
A handle to a SyncStreamDescription that allows subscribing to the stream.
To obtain an instance of SyncStream, call CommonPowerSyncDatabase.syncStream.
Extends
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
name | string | The name of the stream as it appears in the stream definition for the PowerSync service. | SyncStreamDescription.name |
parameters | Record<string, any> | null | The parameters used to subscribe to the stream, if any. The same stream can be subscribed to multiple times with different parameters. | SyncStreamDescription.parameters |
Methods
subscribe()
subscribe(options?): Promise<SyncStreamSubscription>;
Adds a subscription to this stream, requesting it to be included when connecting to the sync service.
You should keep a reference to the returned SyncStreamSubscription object along as you need data for that stream. As soon as SyncStreamSubscription.unsubscribe is called for all subscriptions on this stream (including subscriptions created on other tabs), the SyncStreamSubscribeOptions.ttl starts ticking and will eventually evict the stream (unless SyncStream.subscribe is called again).
Parameters
| Parameter | Type |
|---|---|
options? | SyncStreamSubscribeOptions |
Returns
Promise<SyncStreamSubscription>
unsubscribeAll()
unsubscribeAll(): Promise<void>;
Clears all subscriptions attached to this stream and resets the TTL for the stream.
This is a potentially dangerous operations, as it interferes with other stream subscriptions.
Returns
Promise<void>