Skip to content

Commit b9d1882

Browse files
committed
feat: handle reload event
1 parent b1777dd commit b9d1882

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/y-socket-io/y-socket-io.js

+9
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,15 @@ export class YSocketIO {
370370
}
371371
}
372372
})
373+
socket.onAnyOutgoing(async (ev) => {
374+
if (ev !== 'reload') return
375+
if (!WORKER_DISABLED) return
376+
const namespace = this.getNamespaceString(socket.nsp)
377+
logSocketIO(`reload event triggered, updating namespace doc in: ${namespace}`)
378+
assert(this.client)
379+
const doc = await this.client.getDoc(namespace, 'index')
380+
this.namespaceDocMap.set(namespace, doc)
381+
})
373382
}
374383

375384
/**

0 commit comments

Comments
 (0)