Merge remote-tracking branch 'origin/feat/cloud-sync-saika' into feat/cloud-sync-saika

This commit is contained in:
alt0
2023-01-09 18:53:52 +08:00

View File

@@ -74,6 +74,12 @@ export class AffineProvider extends BaseProvider {
ws = new WebsocketProvider('/', room, doc);
this._wsMap.set(room, ws);
}
// close all websocket links
Array.from(this._wsMap.entries()).forEach(([id, ws]) => {
if (id !== room) {
ws.disconnect();
}
});
ws.connect();
await new Promise<void>((resolve, reject) => {
// TODO: synced will also be triggered on reconnection after losing sync