@livestore/sync-cf 0.4.0-dev.1 → 0.4.0-dev.10
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.
- package/README.md +60 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/cf-worker/do/durable-object.d.ts +45 -0
- package/dist/cf-worker/do/durable-object.d.ts.map +1 -0
- package/dist/cf-worker/do/durable-object.js +150 -0
- package/dist/cf-worker/do/durable-object.js.map +1 -0
- package/dist/cf-worker/do/layer.d.ts +34 -0
- package/dist/cf-worker/do/layer.d.ts.map +1 -0
- package/dist/cf-worker/do/layer.js +91 -0
- package/dist/cf-worker/do/layer.js.map +1 -0
- package/dist/cf-worker/do/pull.d.ts +6 -0
- package/dist/cf-worker/do/pull.d.ts.map +1 -0
- package/dist/cf-worker/do/pull.js +47 -0
- package/dist/cf-worker/do/pull.js.map +1 -0
- package/dist/cf-worker/do/push.d.ts +14 -0
- package/dist/cf-worker/do/push.d.ts.map +1 -0
- package/dist/cf-worker/do/push.js +131 -0
- package/dist/cf-worker/do/push.js.map +1 -0
- package/dist/cf-worker/{durable-object.d.ts → do/sqlite.d.ts} +77 -70
- package/dist/cf-worker/do/sqlite.d.ts.map +1 -0
- package/dist/cf-worker/do/sqlite.js +27 -0
- package/dist/cf-worker/do/sqlite.js.map +1 -0
- package/dist/cf-worker/do/sync-storage.d.ts +25 -0
- package/dist/cf-worker/do/sync-storage.d.ts.map +1 -0
- package/dist/cf-worker/do/sync-storage.js +190 -0
- package/dist/cf-worker/do/sync-storage.js.map +1 -0
- package/dist/cf-worker/do/transport/do-rpc-server.d.ts +9 -0
- package/dist/cf-worker/do/transport/do-rpc-server.d.ts.map +1 -0
- package/dist/cf-worker/do/transport/do-rpc-server.js +45 -0
- package/dist/cf-worker/do/transport/do-rpc-server.js.map +1 -0
- package/dist/cf-worker/do/transport/http-rpc-server.d.ts +7 -0
- package/dist/cf-worker/do/transport/http-rpc-server.d.ts.map +1 -0
- package/dist/cf-worker/do/transport/http-rpc-server.js +24 -0
- package/dist/cf-worker/do/transport/http-rpc-server.js.map +1 -0
- package/dist/cf-worker/do/transport/ws-rpc-server.d.ts +4 -0
- package/dist/cf-worker/do/transport/ws-rpc-server.d.ts.map +1 -0
- package/dist/cf-worker/do/transport/ws-rpc-server.js +21 -0
- package/dist/cf-worker/do/transport/ws-rpc-server.js.map +1 -0
- package/dist/cf-worker/mod.d.ts +4 -2
- package/dist/cf-worker/mod.d.ts.map +1 -1
- package/dist/cf-worker/mod.js +3 -2
- package/dist/cf-worker/mod.js.map +1 -1
- package/dist/cf-worker/shared.d.ts +147 -0
- package/dist/cf-worker/shared.d.ts.map +1 -0
- package/dist/cf-worker/shared.js +32 -0
- package/dist/cf-worker/shared.js.map +1 -0
- package/dist/cf-worker/worker.d.ts +45 -45
- package/dist/cf-worker/worker.d.ts.map +1 -1
- package/dist/cf-worker/worker.js +51 -39
- package/dist/cf-worker/worker.js.map +1 -1
- package/dist/client/mod.d.ts +4 -0
- package/dist/client/mod.d.ts.map +1 -0
- package/dist/client/mod.js +4 -0
- package/dist/client/mod.js.map +1 -0
- package/dist/client/transport/do-rpc-client.d.ts +40 -0
- package/dist/client/transport/do-rpc-client.d.ts.map +1 -0
- package/dist/client/transport/do-rpc-client.js +117 -0
- package/dist/client/transport/do-rpc-client.js.map +1 -0
- package/dist/client/transport/http-rpc-client.d.ts +43 -0
- package/dist/client/transport/http-rpc-client.d.ts.map +1 -0
- package/dist/client/transport/http-rpc-client.js +103 -0
- package/dist/client/transport/http-rpc-client.js.map +1 -0
- package/dist/client/transport/ws-rpc-client.d.ts +45 -0
- package/dist/client/transport/ws-rpc-client.d.ts.map +1 -0
- package/dist/client/transport/ws-rpc-client.js +108 -0
- package/dist/client/transport/ws-rpc-client.js.map +1 -0
- package/dist/common/constants.d.ts +7 -0
- package/dist/common/constants.d.ts.map +1 -0
- package/dist/common/constants.js +17 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/do-rpc-schema.d.ts +76 -0
- package/dist/common/do-rpc-schema.d.ts.map +1 -0
- package/dist/common/do-rpc-schema.js +48 -0
- package/dist/common/do-rpc-schema.js.map +1 -0
- package/dist/common/http-rpc-schema.d.ts +58 -0
- package/dist/common/http-rpc-schema.d.ts.map +1 -0
- package/dist/common/http-rpc-schema.js +37 -0
- package/dist/common/http-rpc-schema.js.map +1 -0
- package/dist/common/mod.d.ts +8 -1
- package/dist/common/mod.d.ts.map +1 -1
- package/dist/common/mod.js +7 -1
- package/dist/common/mod.js.map +1 -1
- package/dist/common/{ws-message-types.d.ts → sync-message-types.d.ts} +119 -153
- package/dist/common/sync-message-types.d.ts.map +1 -0
- package/dist/common/sync-message-types.js +60 -0
- package/dist/common/sync-message-types.js.map +1 -0
- package/dist/common/ws-rpc-schema.d.ts +55 -0
- package/dist/common/ws-rpc-schema.d.ts.map +1 -0
- package/dist/common/ws-rpc-schema.js +32 -0
- package/dist/common/ws-rpc-schema.js.map +1 -0
- package/package.json +7 -8
- package/src/cf-worker/do/durable-object.ts +237 -0
- package/src/cf-worker/do/layer.ts +128 -0
- package/src/cf-worker/do/pull.ts +77 -0
- package/src/cf-worker/do/push.ts +205 -0
- package/src/cf-worker/do/sqlite.ts +28 -0
- package/src/cf-worker/do/sync-storage.ts +321 -0
- package/src/cf-worker/do/transport/do-rpc-server.ts +84 -0
- package/src/cf-worker/do/transport/http-rpc-server.ts +37 -0
- package/src/cf-worker/do/transport/ws-rpc-server.ts +34 -0
- package/src/cf-worker/mod.ts +4 -2
- package/src/cf-worker/shared.ts +112 -0
- package/src/cf-worker/worker.ts +91 -105
- package/src/client/mod.ts +3 -0
- package/src/client/transport/do-rpc-client.ts +191 -0
- package/src/client/transport/http-rpc-client.ts +225 -0
- package/src/client/transport/ws-rpc-client.ts +202 -0
- package/src/common/constants.ts +18 -0
- package/src/common/do-rpc-schema.ts +54 -0
- package/src/common/http-rpc-schema.ts +40 -0
- package/src/common/mod.ts +10 -1
- package/src/common/sync-message-types.ts +117 -0
- package/src/common/ws-rpc-schema.ts +36 -0
- package/dist/cf-worker/cf-types.d.ts +0 -2
- package/dist/cf-worker/cf-types.d.ts.map +0 -1
- package/dist/cf-worker/cf-types.js +0 -2
- package/dist/cf-worker/cf-types.js.map +0 -1
- package/dist/cf-worker/durable-object.d.ts.map +0 -1
- package/dist/cf-worker/durable-object.js +0 -317
- package/dist/cf-worker/durable-object.js.map +0 -1
- package/dist/common/ws-message-types.d.ts.map +0 -1
- package/dist/common/ws-message-types.js +0 -57
- package/dist/common/ws-message-types.js.map +0 -1
- package/dist/sync-impl/mod.d.ts +0 -2
- package/dist/sync-impl/mod.d.ts.map +0 -1
- package/dist/sync-impl/mod.js +0 -2
- package/dist/sync-impl/mod.js.map +0 -1
- package/dist/sync-impl/ws-impl.d.ts +0 -7
- package/dist/sync-impl/ws-impl.d.ts.map +0 -1
- package/dist/sync-impl/ws-impl.js +0 -175
- package/dist/sync-impl/ws-impl.js.map +0 -1
- package/src/cf-worker/cf-types.ts +0 -12
- package/src/cf-worker/durable-object.ts +0 -478
- package/src/common/ws-message-types.ts +0 -114
- package/src/sync-impl/mod.ts +0 -1
- package/src/sync-impl/ws-impl.ts +0 -274
package/src/sync-impl/ws-impl.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
|
-
|
|
3
|
-
import type { SyncBackend, SyncBackendConstructor } from '@livestore/common'
|
|
4
|
-
import { InvalidPullError, InvalidPushError, UnexpectedError } from '@livestore/common'
|
|
5
|
-
import { EventSequenceNumber } from '@livestore/common/schema'
|
|
6
|
-
import { LS_DEV, shouldNeverHappen } from '@livestore/utils'
|
|
7
|
-
import {
|
|
8
|
-
Deferred,
|
|
9
|
-
Effect,
|
|
10
|
-
Option,
|
|
11
|
-
PubSub,
|
|
12
|
-
Queue,
|
|
13
|
-
Schedule,
|
|
14
|
-
Schema,
|
|
15
|
-
Stream,
|
|
16
|
-
SubscriptionRef,
|
|
17
|
-
UrlParams,
|
|
18
|
-
WebSocket,
|
|
19
|
-
} from '@livestore/utils/effect'
|
|
20
|
-
import { nanoid } from '@livestore/utils/nanoid'
|
|
21
|
-
|
|
22
|
-
import { SearchParamsSchema, WSMessage } from '../common/mod.ts'
|
|
23
|
-
import type { SyncMetadata } from '../common/ws-message-types.ts'
|
|
24
|
-
|
|
25
|
-
export interface WsSyncOptions {
|
|
26
|
-
url: string
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const makeCfSync =
|
|
30
|
-
(options: WsSyncOptions): SyncBackendConstructor<SyncMetadata> =>
|
|
31
|
-
({ storeId, payload }) =>
|
|
32
|
-
Effect.gen(function* () {
|
|
33
|
-
const urlParamsData = yield* Schema.encode(SearchParamsSchema)({
|
|
34
|
-
storeId,
|
|
35
|
-
payload,
|
|
36
|
-
}).pipe(UnexpectedError.mapToUnexpectedError)
|
|
37
|
-
|
|
38
|
-
const urlParams = UrlParams.fromInput(urlParamsData)
|
|
39
|
-
const wsUrl = `${options.url}/websocket?${UrlParams.toString(urlParams)}`
|
|
40
|
-
|
|
41
|
-
const { isConnected, incomingMessages, send } = yield* connect(wsUrl)
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* We need to account for the scenario where push-caused PullRes message arrive before the pull-caused PullRes message.
|
|
45
|
-
* i.e. a scenario where the WS connection is created but before the server processed the initial pull, a push from
|
|
46
|
-
* another client triggers a PullRes message sent to this client which we need to stash until our pull-caused
|
|
47
|
-
* PullRes message arrives at which point we can combine the stashed events with the pull-caused events and continue.
|
|
48
|
-
*/
|
|
49
|
-
const stashedPullBatch: WSMessage.PullRes['batch'][number][] = []
|
|
50
|
-
|
|
51
|
-
// We currently only support one pull stream for a sync backend.
|
|
52
|
-
let pullStarted = false
|
|
53
|
-
|
|
54
|
-
const api = {
|
|
55
|
-
isConnected,
|
|
56
|
-
// Currently we're already eagerly connecting when the sync backend is created but we might want to refactor this later to clean this up
|
|
57
|
-
connect: Effect.void,
|
|
58
|
-
pull: (args) =>
|
|
59
|
-
Effect.gen(function* () {
|
|
60
|
-
if (pullStarted) {
|
|
61
|
-
return shouldNeverHappen(`Pull already started for this sync backend.`)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
pullStarted = true
|
|
65
|
-
|
|
66
|
-
let pullResponseReceived = false
|
|
67
|
-
|
|
68
|
-
const requestId = nanoid()
|
|
69
|
-
const cursor = Option.getOrUndefined(args)?.cursor.global
|
|
70
|
-
|
|
71
|
-
yield* send(WSMessage.PullReq.make({ cursor, requestId }))
|
|
72
|
-
|
|
73
|
-
return Stream.fromPubSub(incomingMessages).pipe(
|
|
74
|
-
Stream.tap((_) =>
|
|
75
|
-
_._tag === 'WSMessage.Error' && _.requestId === requestId
|
|
76
|
-
? new InvalidPullError({ message: _.message })
|
|
77
|
-
: Effect.void,
|
|
78
|
-
),
|
|
79
|
-
Stream.filterMap((msg) => {
|
|
80
|
-
if (msg._tag === 'WSMessage.PullRes') {
|
|
81
|
-
if (msg.requestId.context === 'pull') {
|
|
82
|
-
if (msg.requestId.requestId === requestId) {
|
|
83
|
-
pullResponseReceived = true
|
|
84
|
-
|
|
85
|
-
if (stashedPullBatch.length > 0 && msg.remaining === 0) {
|
|
86
|
-
const pullResHead = msg.batch.at(-1)?.eventEncoded.seqNum ?? EventSequenceNumber.ROOT.global
|
|
87
|
-
// Index where stashed events are greater than pullResHead
|
|
88
|
-
const newPartialBatchIndex = stashedPullBatch.findIndex(
|
|
89
|
-
(batchItem) => batchItem.eventEncoded.seqNum > pullResHead,
|
|
90
|
-
)
|
|
91
|
-
const batchWithNewStashedEvents =
|
|
92
|
-
newPartialBatchIndex === -1 ? [] : stashedPullBatch.slice(newPartialBatchIndex)
|
|
93
|
-
const combinedBatch = [...msg.batch, ...batchWithNewStashedEvents]
|
|
94
|
-
return Option.some({ ...msg, batch: combinedBatch, remaining: 0 })
|
|
95
|
-
} else {
|
|
96
|
-
return Option.some(msg)
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
// Ignore
|
|
100
|
-
return Option.none()
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
if (pullResponseReceived) {
|
|
104
|
-
return Option.some(msg)
|
|
105
|
-
} else {
|
|
106
|
-
stashedPullBatch.push(...msg.batch)
|
|
107
|
-
return Option.none()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return Option.none()
|
|
113
|
-
}),
|
|
114
|
-
)
|
|
115
|
-
}).pipe(Stream.unwrap),
|
|
116
|
-
|
|
117
|
-
push: (batch) =>
|
|
118
|
-
Effect.gen(function* () {
|
|
119
|
-
const pushAck = yield* Deferred.make<void, InvalidPushError>()
|
|
120
|
-
const requestId = nanoid()
|
|
121
|
-
|
|
122
|
-
yield* Stream.fromPubSub(incomingMessages).pipe(
|
|
123
|
-
Stream.tap((_) =>
|
|
124
|
-
_._tag === 'WSMessage.Error' && _.requestId === requestId
|
|
125
|
-
? Deferred.fail(pushAck, new InvalidPushError({ reason: { _tag: 'Unexpected', message: _.message } }))
|
|
126
|
-
: Effect.void,
|
|
127
|
-
),
|
|
128
|
-
Stream.filter((_) => _._tag === 'WSMessage.PushAck' && _.requestId === requestId),
|
|
129
|
-
Stream.take(1),
|
|
130
|
-
Stream.tap(() => Deferred.succeed(pushAck, void 0)),
|
|
131
|
-
Stream.runDrain,
|
|
132
|
-
Effect.tapCauseLogPretty,
|
|
133
|
-
Effect.fork,
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
yield* send(WSMessage.PushReq.make({ batch, requestId }))
|
|
137
|
-
|
|
138
|
-
yield* pushAck
|
|
139
|
-
}),
|
|
140
|
-
metadata: {
|
|
141
|
-
name: '@livestore/cf-sync',
|
|
142
|
-
description: 'LiveStore sync backend implementation using Cloudflare Workers & Durable Objects',
|
|
143
|
-
protocol: 'ws',
|
|
144
|
-
url: options.url,
|
|
145
|
-
},
|
|
146
|
-
} satisfies SyncBackend<SyncMetadata>
|
|
147
|
-
|
|
148
|
-
return api
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
const connect = (wsUrl: string) =>
|
|
152
|
-
Effect.gen(function* () {
|
|
153
|
-
const isConnected = yield* SubscriptionRef.make(false)
|
|
154
|
-
const socketRef: { current: globalThis.WebSocket | undefined } = { current: undefined }
|
|
155
|
-
|
|
156
|
-
const incomingMessages = yield* PubSub.unbounded<Exclude<WSMessage.BackendToClientMessage, WSMessage.Pong>>().pipe(
|
|
157
|
-
Effect.acquireRelease(PubSub.shutdown),
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
const waitUntilOnline = isConnected.changes.pipe(Stream.filter(Boolean), Stream.take(1), Stream.runDrain)
|
|
161
|
-
|
|
162
|
-
const send = (message: WSMessage.Message) =>
|
|
163
|
-
Effect.gen(function* () {
|
|
164
|
-
// Wait first until we're online
|
|
165
|
-
yield* waitUntilOnline
|
|
166
|
-
|
|
167
|
-
// TODO use MsgPack instead of JSON to speed up the serialization / reduce the size of the messages
|
|
168
|
-
socketRef.current!.send(Schema.encodeSync(Schema.parseJson(WSMessage.Message))(message))
|
|
169
|
-
|
|
170
|
-
if (LS_DEV) {
|
|
171
|
-
yield* Effect.spanEvent(
|
|
172
|
-
`Sent message: ${message._tag}`,
|
|
173
|
-
message._tag === 'WSMessage.PushReq'
|
|
174
|
-
? {
|
|
175
|
-
seqNum: message.batch[0]!.seqNum,
|
|
176
|
-
parentSeqNum: message.batch[0]!.parentSeqNum,
|
|
177
|
-
batchLength: message.batch.length,
|
|
178
|
-
}
|
|
179
|
-
: message._tag === 'WSMessage.PullReq'
|
|
180
|
-
? { cursor: message.cursor ?? '-' }
|
|
181
|
-
: {},
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
const innerConnect = Effect.gen(function* () {
|
|
187
|
-
// If the browser already tells us we're offline, then we'll at least wait until the browser
|
|
188
|
-
// thinks we're online again. (We'll only know for sure once the WS conneciton is established.)
|
|
189
|
-
while (typeof navigator !== 'undefined' && navigator.onLine === false) {
|
|
190
|
-
yield* Effect.sleep(1000)
|
|
191
|
-
}
|
|
192
|
-
// TODO bring this back in a cross-platform way
|
|
193
|
-
// if (navigator.onLine === false) {
|
|
194
|
-
// yield* Effect.async((cb) => self.addEventListener('online', () => cb(Effect.void)))
|
|
195
|
-
// }
|
|
196
|
-
|
|
197
|
-
const socket = yield* WebSocket.makeWebSocket({ url: wsUrl, reconnect: Schedule.exponential(100) })
|
|
198
|
-
// socket.binaryType = 'arraybuffer'
|
|
199
|
-
|
|
200
|
-
yield* SubscriptionRef.set(isConnected, true)
|
|
201
|
-
socketRef.current = socket
|
|
202
|
-
|
|
203
|
-
const connectionClosed = yield* Deferred.make<void>()
|
|
204
|
-
|
|
205
|
-
const pongMessages = yield* Queue.unbounded<WSMessage.Pong>().pipe(Effect.acquireRelease(Queue.shutdown))
|
|
206
|
-
|
|
207
|
-
yield* Effect.eventListener(socket, 'message', (event: MessageEvent) =>
|
|
208
|
-
Effect.gen(function* () {
|
|
209
|
-
const decodedEventRes = Schema.decodeUnknownEither(Schema.parseJson(WSMessage.BackendToClientMessage))(
|
|
210
|
-
event.data,
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
if (decodedEventRes._tag === 'Left') {
|
|
214
|
-
console.error('Sync: Invalid message received', decodedEventRes.left)
|
|
215
|
-
return
|
|
216
|
-
} else {
|
|
217
|
-
if (decodedEventRes.right._tag === 'WSMessage.Pong') {
|
|
218
|
-
yield* Queue.offer(pongMessages, decodedEventRes.right)
|
|
219
|
-
} else {
|
|
220
|
-
// yield* Effect.logDebug(`decodedEventRes: ${decodedEventRes.right._tag}`)
|
|
221
|
-
yield* PubSub.publish(incomingMessages, decodedEventRes.right)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}),
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
yield* Effect.eventListener(socket, 'close', () => Deferred.succeed(connectionClosed, void 0))
|
|
228
|
-
|
|
229
|
-
yield* Effect.eventListener(socket, 'error', () =>
|
|
230
|
-
Effect.gen(function* () {
|
|
231
|
-
socket.close(3000, 'Sync: WebSocket error')
|
|
232
|
-
yield* Deferred.succeed(connectionClosed, void 0)
|
|
233
|
-
}),
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
// NOTE it seems that this callback doesn't work reliably on a worker but only via `window.addEventListener`
|
|
237
|
-
// We might need to proxy the event from the main thread to the worker if we want this to work reliably.
|
|
238
|
-
|
|
239
|
-
if (typeof self !== 'undefined' && typeof self.addEventListener === 'function') {
|
|
240
|
-
// TODO support an Expo equivalent for this
|
|
241
|
-
|
|
242
|
-
yield* Effect.eventListener(self, 'offline', () => Deferred.succeed(connectionClosed, void 0))
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
yield* Effect.addFinalizer(() =>
|
|
246
|
-
Effect.gen(function* () {
|
|
247
|
-
socketRef.current = undefined
|
|
248
|
-
yield* SubscriptionRef.set(isConnected, false)
|
|
249
|
-
}),
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
const checkPingPong = Effect.gen(function* () {
|
|
253
|
-
// TODO include pong latency infomation in network status
|
|
254
|
-
yield* send({ _tag: 'WSMessage.Ping', requestId: 'ping' })
|
|
255
|
-
|
|
256
|
-
// NOTE those numbers might need more fine-tuning to allow for bad network conditions
|
|
257
|
-
yield* Queue.take(pongMessages).pipe(Effect.timeout(5000))
|
|
258
|
-
|
|
259
|
-
yield* Effect.sleep(25_000)
|
|
260
|
-
}).pipe(Effect.withSpan('@livestore/sync-cf:connect:checkPingPong'), Effect.ignore)
|
|
261
|
-
|
|
262
|
-
yield* waitUntilOnline.pipe(
|
|
263
|
-
Effect.andThen(checkPingPong.pipe(Effect.forever)),
|
|
264
|
-
Effect.tapErrorCause(() => Deferred.succeed(connectionClosed, void 0)),
|
|
265
|
-
Effect.forkScoped,
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
yield* connectionClosed
|
|
269
|
-
}).pipe(Effect.scoped, Effect.withSpan('@livestore/sync-cf:connect'))
|
|
270
|
-
|
|
271
|
-
yield* innerConnect.pipe(Effect.forever, Effect.interruptible, Effect.tapCauseLogPretty, Effect.forkScoped)
|
|
272
|
-
|
|
273
|
-
return { isConnected, incomingMessages, send }
|
|
274
|
-
})
|