@base44-preview/sdk 0.8.35-pr.212.9dba072 → 0.8.35-pr.212.bb22a83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,8 +7,8 @@ export declare function createRealtimeModule(config: {
|
|
|
7
7
|
interface RealtimeSubscription {
|
|
8
8
|
/** This connection's id — the same value the handler receives as `conn.id`. */
|
|
9
9
|
id: string;
|
|
10
|
-
/** Close the subscription and its socket. */
|
|
11
|
-
|
|
10
|
+
/** Close the subscription and its underlying socket. */
|
|
11
|
+
unsubscribe(): void;
|
|
12
12
|
}
|
|
13
13
|
interface RealtimeHandler {
|
|
14
14
|
subscribe(instanceId: string, callback: (data: unknown) => void, options?: {
|
package/dist/modules/realtime.js
CHANGED
|
@@ -39,7 +39,7 @@ type OutboundFor<N extends string> = N extends keyof RealtimeHandlerRegistry ? R
|
|
|
39
39
|
export interface RealtimeHandlerClient<N extends string = string> {
|
|
40
40
|
/**
|
|
41
41
|
* Open a WebSocket subscription. Returns a {@link RealtimeSubscription} with the
|
|
42
|
-
* connection `id` (same value the handler sees as `conn.id`) and
|
|
42
|
+
* connection `id` (same value the handler sees as `conn.id`) and an `unsubscribe()` method.
|
|
43
43
|
*
|
|
44
44
|
* Pass `options.id` to control the connection id (e.g. a stable per-tab id so a
|
|
45
45
|
* reconnect reuses the same server-side connection); omit it for an auto-generated
|
|
@@ -56,7 +56,7 @@ export interface RealtimeSubscription {
|
|
|
56
56
|
/** This connection's id — the same value the handler receives as `conn.id`. */
|
|
57
57
|
id: string;
|
|
58
58
|
/** Close the subscription and its underlying socket. */
|
|
59
|
-
|
|
59
|
+
unsubscribe(): void;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* The realtime module provides access to Cloudflare Durable Object-backed
|
|
@@ -67,8 +67,8 @@ export interface RealtimeSubscription {
|
|
|
67
67
|
* const sub = await base44.realtime.MyHandler.subscribe("room-1", (msg) => {
|
|
68
68
|
* console.log(msg); // typed if MyHandler is in RealtimeHandlerRegistry
|
|
69
69
|
* });
|
|
70
|
-
*
|
|
71
|
-
*
|
|
70
|
+
* const { id, unsubscribe } = sub;
|
|
71
|
+
* unsubscribe();
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
74
|
export type RealtimeModule = {
|