@inditextech/weave-store-azure-web-pubsub 0.7.1 → 0.8.0
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/dist/client.cjs +44 -18
- package/dist/client.d.cts +4 -2
- package/dist/client.d.ts +4 -2
- package/dist/client.js +44 -18
- package/dist/server.cjs +9 -1
- package/dist/server.js +9 -1
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -53,6 +53,15 @@ const min = (a, b) => a < b ? a : b;
|
|
|
53
53
|
const max = (a, b) => a > b ? a : b;
|
|
54
54
|
const isNaN$1 = Number.isNaN;
|
|
55
55
|
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region ../../node_modules/lib0/time.js
|
|
58
|
+
/**
|
|
59
|
+
* Return current unix time.
|
|
60
|
+
*
|
|
61
|
+
* @return {number}
|
|
62
|
+
*/
|
|
63
|
+
const getUnixTime = Date.now;
|
|
64
|
+
|
|
56
65
|
//#endregion
|
|
57
66
|
//#region ../../node_modules/lib0/binary.js
|
|
58
67
|
const BIT8 = 128;
|
|
@@ -607,15 +616,6 @@ const readSyncMessage = (decoder, encoder, doc, transactionOrigin) => {
|
|
|
607
616
|
return messageType;
|
|
608
617
|
};
|
|
609
618
|
|
|
610
|
-
//#endregion
|
|
611
|
-
//#region ../../node_modules/lib0/time.js
|
|
612
|
-
/**
|
|
613
|
-
* Return current unix time.
|
|
614
|
-
*
|
|
615
|
-
* @return {number}
|
|
616
|
-
*/
|
|
617
|
-
const getUnixTime = Date.now;
|
|
618
|
-
|
|
619
619
|
//#endregion
|
|
620
620
|
//#region ../../node_modules/lib0/map.js
|
|
621
621
|
/**
|
|
@@ -1042,6 +1042,7 @@ const messageSyncStep1 = 0;
|
|
|
1042
1042
|
const messageAwareness = 1;
|
|
1043
1043
|
const messageQueryAwareness = 3;
|
|
1044
1044
|
const AzureWebPubSubJsonProtocol = "json.webpubsub.azure.v1";
|
|
1045
|
+
const messageReconnectTimeout = 3e4;
|
|
1045
1046
|
let MessageType = /* @__PURE__ */ function(MessageType$1) {
|
|
1046
1047
|
MessageType$1["System"] = "system";
|
|
1047
1048
|
MessageType$1["JoinGroup"] = "joinGroup";
|
|
@@ -1143,6 +1144,7 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends emittery.default {
|
|
|
1143
1144
|
return this._uuid;
|
|
1144
1145
|
}
|
|
1145
1146
|
destroy() {
|
|
1147
|
+
if (this._checkInterval !== null) clearInterval(this._checkInterval);
|
|
1146
1148
|
if (this._resyncInterval !== null) clearInterval(this._resyncInterval);
|
|
1147
1149
|
this.stop();
|
|
1148
1150
|
this.doc.off("update", this._updateHandler);
|
|
@@ -1178,7 +1180,11 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends emittery.default {
|
|
|
1178
1180
|
this.synced = false;
|
|
1179
1181
|
this._status = "connecting";
|
|
1180
1182
|
this.emit("status", this._status);
|
|
1183
|
+
this._checkInterval = setInterval(() => {
|
|
1184
|
+
if (this._ws?.OPEN && messageReconnectTimeout < getUnixTime() - this._wsLastMessageReceived) this._ws.reconnect();
|
|
1185
|
+
}, messageReconnectTimeout / 10);
|
|
1181
1186
|
websocket.onmessage = (event) => {
|
|
1187
|
+
this._wsLastMessageReceived = getUnixTime();
|
|
1182
1188
|
if (event.data === null) return;
|
|
1183
1189
|
const message = JSON.parse(event.data.toString());
|
|
1184
1190
|
if (message.type === MessageType.System) return;
|
|
@@ -1189,6 +1195,7 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends emittery.default {
|
|
|
1189
1195
|
if (length$1(encoder) > 1) sendToControlGroup(this, this.topic, MessageDataType.Sync, toUint8Array(encoder));
|
|
1190
1196
|
};
|
|
1191
1197
|
websocket.onclose = () => {
|
|
1198
|
+
console.error("Websocket closed");
|
|
1192
1199
|
this._ws = null;
|
|
1193
1200
|
if (this._wsConnected) {
|
|
1194
1201
|
this._status = "disconnected";
|
|
@@ -1199,9 +1206,10 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends emittery.default {
|
|
|
1199
1206
|
}
|
|
1200
1207
|
};
|
|
1201
1208
|
websocket.onerror = (err) => {
|
|
1202
|
-
console.error(err);
|
|
1209
|
+
console.error("Websocket error", err);
|
|
1203
1210
|
};
|
|
1204
1211
|
websocket.onopen = () => {
|
|
1212
|
+
console.error("Websocket open");
|
|
1205
1213
|
this._wsConnected = true;
|
|
1206
1214
|
this._status = "connected";
|
|
1207
1215
|
this.emit("status", this._status);
|
|
@@ -1257,7 +1265,23 @@ var WeaveStoreAzureWebPubsub = class extends __inditextech_weave_sdk.WeaveStore
|
|
|
1257
1265
|
resyncInterval: 1e3,
|
|
1258
1266
|
tokenProvider: null
|
|
1259
1267
|
});
|
|
1268
|
+
window.addEventListener("beforeunload", () => {
|
|
1269
|
+
const awareness = this.provider.awareness;
|
|
1270
|
+
awareness.destroy();
|
|
1271
|
+
});
|
|
1260
1272
|
this.provider.on("status", (status) => {
|
|
1273
|
+
if (status === "connected") {
|
|
1274
|
+
this.handleAwarenessChange();
|
|
1275
|
+
const awareness = this.provider.awareness;
|
|
1276
|
+
awareness.on("update", this.handleAwarenessChange.bind(this));
|
|
1277
|
+
awareness.on("change", this.handleAwarenessChange.bind(this));
|
|
1278
|
+
}
|
|
1279
|
+
if (status === "disconnected") {
|
|
1280
|
+
const awareness = this.provider.awareness;
|
|
1281
|
+
awareness.destroy();
|
|
1282
|
+
awareness.off("update", this.handleAwarenessChange.bind(this));
|
|
1283
|
+
awareness.off("change", this.handleAwarenessChange.bind(this));
|
|
1284
|
+
}
|
|
1261
1285
|
this.azureWebPubsubOptions.callbacks?.onConnectionStatusChange?.(status);
|
|
1262
1286
|
this.instance.emitEvent("onConnectionStatusChange", status);
|
|
1263
1287
|
});
|
|
@@ -1290,19 +1314,21 @@ var WeaveStoreAzureWebPubsub = class extends __inditextech_weave_sdk.WeaveStore
|
|
|
1290
1314
|
await this.provider.start();
|
|
1291
1315
|
}
|
|
1292
1316
|
disconnect() {
|
|
1317
|
+
const awareness = this.provider.awareness;
|
|
1318
|
+
awareness.destroy();
|
|
1319
|
+
awareness.off("update", this.handleAwarenessChange.bind(this));
|
|
1320
|
+
awareness.off("change", this.handleAwarenessChange.bind(this));
|
|
1293
1321
|
this.provider.destroy();
|
|
1294
1322
|
}
|
|
1295
|
-
|
|
1323
|
+
handleAwarenessChange(emit = true) {
|
|
1296
1324
|
const awareness = this.provider.awareness;
|
|
1297
|
-
awareness.
|
|
1325
|
+
const values = Array.from(awareness.getStates().values());
|
|
1326
|
+
values.splice(awareness.clientID, 1);
|
|
1327
|
+
if (emit) this.instance.emitEvent("onAwarenessChange", values);
|
|
1298
1328
|
}
|
|
1299
|
-
|
|
1329
|
+
setAwarenessInfo(field, value) {
|
|
1300
1330
|
const awareness = this.provider.awareness;
|
|
1301
|
-
awareness.
|
|
1302
|
-
const values = Array.from(awareness.getStates().values());
|
|
1303
|
-
values.splice(awareness.clientID, 1);
|
|
1304
|
-
callback(values);
|
|
1305
|
-
});
|
|
1331
|
+
awareness.setLocalStateField(field, value);
|
|
1306
1332
|
}
|
|
1307
1333
|
};
|
|
1308
1334
|
|
package/dist/client.d.cts
CHANGED
|
@@ -15,7 +15,6 @@ type WeaveStoreOptions = {
|
|
|
15
15
|
getUser: () => WeaveUser;
|
|
16
16
|
undoManagerOptions?: WeaveUndoManagerOptions;
|
|
17
17
|
};
|
|
18
|
-
type WeaveAwarenessChange<K extends string, T> = { [key in K]: T };
|
|
19
18
|
type WeaveUser = {
|
|
20
19
|
[key: string]: any;
|
|
21
20
|
name: string;
|
|
@@ -74,6 +73,8 @@ declare class WeaveStoreAzureWebPubSubSyncClient extends Emittery {
|
|
|
74
73
|
private _status;
|
|
75
74
|
private _wsConnected;
|
|
76
75
|
private _synced;
|
|
76
|
+
private _wsLastMessageReceived;
|
|
77
|
+
private _checkInterval;
|
|
77
78
|
private _resyncInterval;
|
|
78
79
|
private _uuid;
|
|
79
80
|
private _awareness;
|
|
@@ -106,12 +107,13 @@ declare class WeaveStoreAzureWebPubsub extends WeaveStore {
|
|
|
106
107
|
protected provider: WeaveStoreAzureWebPubSubSyncClient;
|
|
107
108
|
protected name: string;
|
|
108
109
|
protected supportsUndoManager: boolean;
|
|
110
|
+
protected awarenessCallback: (changes: any) => void;
|
|
109
111
|
constructor(storeOptions: WeaveStoreOptions, azureWebPubsubOptions: WeaveStoreAzureWebPubsubOptions);
|
|
110
112
|
private init;
|
|
111
113
|
connect(): Promise<void>;
|
|
112
114
|
disconnect(): void;
|
|
115
|
+
handleAwarenessChange(emit?: boolean): void;
|
|
113
116
|
setAwarenessInfo(field: string, value: unknown): void;
|
|
114
|
-
onAwarenessChange<K extends string, T>(callback: (changes: WeaveAwarenessChange<K, T>[]) => void): void;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
//#endregion
|
package/dist/client.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ type WeaveStoreOptions = {
|
|
|
15
15
|
getUser: () => WeaveUser;
|
|
16
16
|
undoManagerOptions?: WeaveUndoManagerOptions;
|
|
17
17
|
};
|
|
18
|
-
type WeaveAwarenessChange<K extends string, T> = { [key in K]: T };
|
|
19
18
|
type WeaveUser = {
|
|
20
19
|
[key: string]: any;
|
|
21
20
|
name: string;
|
|
@@ -74,6 +73,8 @@ declare class WeaveStoreAzureWebPubSubSyncClient extends Emittery {
|
|
|
74
73
|
private _status;
|
|
75
74
|
private _wsConnected;
|
|
76
75
|
private _synced;
|
|
76
|
+
private _wsLastMessageReceived;
|
|
77
|
+
private _checkInterval;
|
|
77
78
|
private _resyncInterval;
|
|
78
79
|
private _uuid;
|
|
79
80
|
private _awareness;
|
|
@@ -106,12 +107,13 @@ declare class WeaveStoreAzureWebPubsub extends WeaveStore {
|
|
|
106
107
|
protected provider: WeaveStoreAzureWebPubSubSyncClient;
|
|
107
108
|
protected name: string;
|
|
108
109
|
protected supportsUndoManager: boolean;
|
|
110
|
+
protected awarenessCallback: (changes: any) => void;
|
|
109
111
|
constructor(storeOptions: WeaveStoreOptions, azureWebPubsubOptions: WeaveStoreAzureWebPubsubOptions);
|
|
110
112
|
private init;
|
|
111
113
|
connect(): Promise<void>;
|
|
112
114
|
disconnect(): void;
|
|
115
|
+
handleAwarenessChange(emit?: boolean): void;
|
|
113
116
|
setAwarenessInfo(field: string, value: unknown): void;
|
|
114
|
-
onAwarenessChange<K extends string, T>(callback: (changes: WeaveAwarenessChange<K, T>[]) => void): void;
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
//#endregion
|
package/dist/client.js
CHANGED
|
@@ -30,6 +30,15 @@ const min = (a, b) => a < b ? a : b;
|
|
|
30
30
|
const max = (a, b) => a > b ? a : b;
|
|
31
31
|
const isNaN$1 = Number.isNaN;
|
|
32
32
|
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ../../node_modules/lib0/time.js
|
|
35
|
+
/**
|
|
36
|
+
* Return current unix time.
|
|
37
|
+
*
|
|
38
|
+
* @return {number}
|
|
39
|
+
*/
|
|
40
|
+
const getUnixTime = Date.now;
|
|
41
|
+
|
|
33
42
|
//#endregion
|
|
34
43
|
//#region ../../node_modules/lib0/binary.js
|
|
35
44
|
const BIT8 = 128;
|
|
@@ -584,15 +593,6 @@ const readSyncMessage = (decoder, encoder, doc, transactionOrigin) => {
|
|
|
584
593
|
return messageType;
|
|
585
594
|
};
|
|
586
595
|
|
|
587
|
-
//#endregion
|
|
588
|
-
//#region ../../node_modules/lib0/time.js
|
|
589
|
-
/**
|
|
590
|
-
* Return current unix time.
|
|
591
|
-
*
|
|
592
|
-
* @return {number}
|
|
593
|
-
*/
|
|
594
|
-
const getUnixTime = Date.now;
|
|
595
|
-
|
|
596
596
|
//#endregion
|
|
597
597
|
//#region ../../node_modules/lib0/map.js
|
|
598
598
|
/**
|
|
@@ -1019,6 +1019,7 @@ const messageSyncStep1 = 0;
|
|
|
1019
1019
|
const messageAwareness = 1;
|
|
1020
1020
|
const messageQueryAwareness = 3;
|
|
1021
1021
|
const AzureWebPubSubJsonProtocol = "json.webpubsub.azure.v1";
|
|
1022
|
+
const messageReconnectTimeout = 3e4;
|
|
1022
1023
|
let MessageType = /* @__PURE__ */ function(MessageType$1) {
|
|
1023
1024
|
MessageType$1["System"] = "system";
|
|
1024
1025
|
MessageType$1["JoinGroup"] = "joinGroup";
|
|
@@ -1120,6 +1121,7 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends Emittery {
|
|
|
1120
1121
|
return this._uuid;
|
|
1121
1122
|
}
|
|
1122
1123
|
destroy() {
|
|
1124
|
+
if (this._checkInterval !== null) clearInterval(this._checkInterval);
|
|
1123
1125
|
if (this._resyncInterval !== null) clearInterval(this._resyncInterval);
|
|
1124
1126
|
this.stop();
|
|
1125
1127
|
this.doc.off("update", this._updateHandler);
|
|
@@ -1155,7 +1157,11 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends Emittery {
|
|
|
1155
1157
|
this.synced = false;
|
|
1156
1158
|
this._status = "connecting";
|
|
1157
1159
|
this.emit("status", this._status);
|
|
1160
|
+
this._checkInterval = setInterval(() => {
|
|
1161
|
+
if (this._ws?.OPEN && messageReconnectTimeout < getUnixTime() - this._wsLastMessageReceived) this._ws.reconnect();
|
|
1162
|
+
}, messageReconnectTimeout / 10);
|
|
1158
1163
|
websocket.onmessage = (event) => {
|
|
1164
|
+
this._wsLastMessageReceived = getUnixTime();
|
|
1159
1165
|
if (event.data === null) return;
|
|
1160
1166
|
const message = JSON.parse(event.data.toString());
|
|
1161
1167
|
if (message.type === MessageType.System) return;
|
|
@@ -1166,6 +1172,7 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends Emittery {
|
|
|
1166
1172
|
if (length$1(encoder) > 1) sendToControlGroup(this, this.topic, MessageDataType.Sync, toUint8Array(encoder));
|
|
1167
1173
|
};
|
|
1168
1174
|
websocket.onclose = () => {
|
|
1175
|
+
console.error("Websocket closed");
|
|
1169
1176
|
this._ws = null;
|
|
1170
1177
|
if (this._wsConnected) {
|
|
1171
1178
|
this._status = "disconnected";
|
|
@@ -1176,9 +1183,10 @@ var WeaveStoreAzureWebPubSubSyncClient = class extends Emittery {
|
|
|
1176
1183
|
}
|
|
1177
1184
|
};
|
|
1178
1185
|
websocket.onerror = (err) => {
|
|
1179
|
-
console.error(err);
|
|
1186
|
+
console.error("Websocket error", err);
|
|
1180
1187
|
};
|
|
1181
1188
|
websocket.onopen = () => {
|
|
1189
|
+
console.error("Websocket open");
|
|
1182
1190
|
this._wsConnected = true;
|
|
1183
1191
|
this._status = "connected";
|
|
1184
1192
|
this.emit("status", this._status);
|
|
@@ -1234,7 +1242,23 @@ var WeaveStoreAzureWebPubsub = class extends WeaveStore {
|
|
|
1234
1242
|
resyncInterval: 1e3,
|
|
1235
1243
|
tokenProvider: null
|
|
1236
1244
|
});
|
|
1245
|
+
window.addEventListener("beforeunload", () => {
|
|
1246
|
+
const awareness = this.provider.awareness;
|
|
1247
|
+
awareness.destroy();
|
|
1248
|
+
});
|
|
1237
1249
|
this.provider.on("status", (status) => {
|
|
1250
|
+
if (status === "connected") {
|
|
1251
|
+
this.handleAwarenessChange();
|
|
1252
|
+
const awareness = this.provider.awareness;
|
|
1253
|
+
awareness.on("update", this.handleAwarenessChange.bind(this));
|
|
1254
|
+
awareness.on("change", this.handleAwarenessChange.bind(this));
|
|
1255
|
+
}
|
|
1256
|
+
if (status === "disconnected") {
|
|
1257
|
+
const awareness = this.provider.awareness;
|
|
1258
|
+
awareness.destroy();
|
|
1259
|
+
awareness.off("update", this.handleAwarenessChange.bind(this));
|
|
1260
|
+
awareness.off("change", this.handleAwarenessChange.bind(this));
|
|
1261
|
+
}
|
|
1238
1262
|
this.azureWebPubsubOptions.callbacks?.onConnectionStatusChange?.(status);
|
|
1239
1263
|
this.instance.emitEvent("onConnectionStatusChange", status);
|
|
1240
1264
|
});
|
|
@@ -1267,19 +1291,21 @@ var WeaveStoreAzureWebPubsub = class extends WeaveStore {
|
|
|
1267
1291
|
await this.provider.start();
|
|
1268
1292
|
}
|
|
1269
1293
|
disconnect() {
|
|
1294
|
+
const awareness = this.provider.awareness;
|
|
1295
|
+
awareness.destroy();
|
|
1296
|
+
awareness.off("update", this.handleAwarenessChange.bind(this));
|
|
1297
|
+
awareness.off("change", this.handleAwarenessChange.bind(this));
|
|
1270
1298
|
this.provider.destroy();
|
|
1271
1299
|
}
|
|
1272
|
-
|
|
1300
|
+
handleAwarenessChange(emit = true) {
|
|
1273
1301
|
const awareness = this.provider.awareness;
|
|
1274
|
-
awareness.
|
|
1302
|
+
const values = Array.from(awareness.getStates().values());
|
|
1303
|
+
values.splice(awareness.clientID, 1);
|
|
1304
|
+
if (emit) this.instance.emitEvent("onAwarenessChange", values);
|
|
1275
1305
|
}
|
|
1276
|
-
|
|
1306
|
+
setAwarenessInfo(field, value) {
|
|
1277
1307
|
const awareness = this.provider.awareness;
|
|
1278
|
-
awareness.
|
|
1279
|
-
const values = Array.from(awareness.getStates().values());
|
|
1280
|
-
values.splice(awareness.clientID, 1);
|
|
1281
|
-
callback(values);
|
|
1282
|
-
});
|
|
1308
|
+
awareness.setLocalStateField(field, value);
|
|
1283
1309
|
}
|
|
1284
1310
|
};
|
|
1285
1311
|
|
package/dist/server.cjs
CHANGED
|
@@ -1060,7 +1060,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
|
|
|
1060
1060
|
this._awareness = new Awareness(this.doc);
|
|
1061
1061
|
this._awareness.setLocalState(null);
|
|
1062
1062
|
const awarenessUpdateHandler = ({ added, updated, removed }) => {
|
|
1063
|
-
const changedClients = added.concat(updated, removed);
|
|
1063
|
+
const changedClients = added.concat(added, updated, removed);
|
|
1064
1064
|
const encoder = createEncoder();
|
|
1065
1065
|
writeVarUint(encoder, messageAwareness);
|
|
1066
1066
|
writeVarUint8Array(encoder, encodeAwarenessUpdate(this._awareness, changedClients));
|
|
@@ -1080,6 +1080,13 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
|
|
|
1080
1080
|
get awareness() {
|
|
1081
1081
|
return this._awareness;
|
|
1082
1082
|
}
|
|
1083
|
+
sendInitAwarenessInfo() {
|
|
1084
|
+
const encoderAwarenessState = createEncoder();
|
|
1085
|
+
writeVarUint(encoderAwarenessState, messageAwareness);
|
|
1086
|
+
writeVarUint8Array(encoderAwarenessState, encodeAwarenessUpdate(this._awareness, Array.from(this._awareness.getStates().keys())));
|
|
1087
|
+
const u8 = toUint8Array(encoderAwarenessState);
|
|
1088
|
+
this.broadcast(this.topic, u8);
|
|
1089
|
+
}
|
|
1083
1090
|
async start() {
|
|
1084
1091
|
const url = await this.negotiate(this.topic);
|
|
1085
1092
|
const conn = new this._polyfill(url, "json.webpubsub.azure.v1");
|
|
@@ -1090,6 +1097,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
|
|
|
1090
1097
|
case MessageDataType.Init:
|
|
1091
1098
|
this.onClientInit(group, event.data);
|
|
1092
1099
|
this.onClientSync(group, event.data);
|
|
1100
|
+
this.sendInitAwarenessInfo();
|
|
1093
1101
|
return;
|
|
1094
1102
|
case MessageDataType.Sync:
|
|
1095
1103
|
this.onClientSync(group, event.data);
|
package/dist/server.js
CHANGED
|
@@ -1038,7 +1038,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
|
|
|
1038
1038
|
this._awareness = new Awareness(this.doc);
|
|
1039
1039
|
this._awareness.setLocalState(null);
|
|
1040
1040
|
const awarenessUpdateHandler = ({ added, updated, removed }) => {
|
|
1041
|
-
const changedClients = added.concat(updated, removed);
|
|
1041
|
+
const changedClients = added.concat(added, updated, removed);
|
|
1042
1042
|
const encoder = createEncoder();
|
|
1043
1043
|
writeVarUint(encoder, messageAwareness);
|
|
1044
1044
|
writeVarUint8Array(encoder, encodeAwarenessUpdate(this._awareness, changedClients));
|
|
@@ -1058,6 +1058,13 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
|
|
|
1058
1058
|
get awareness() {
|
|
1059
1059
|
return this._awareness;
|
|
1060
1060
|
}
|
|
1061
|
+
sendInitAwarenessInfo() {
|
|
1062
|
+
const encoderAwarenessState = createEncoder();
|
|
1063
|
+
writeVarUint(encoderAwarenessState, messageAwareness);
|
|
1064
|
+
writeVarUint8Array(encoderAwarenessState, encodeAwarenessUpdate(this._awareness, Array.from(this._awareness.getStates().keys())));
|
|
1065
|
+
const u8 = toUint8Array(encoderAwarenessState);
|
|
1066
|
+
this.broadcast(this.topic, u8);
|
|
1067
|
+
}
|
|
1061
1068
|
async start() {
|
|
1062
1069
|
const url = await this.negotiate(this.topic);
|
|
1063
1070
|
const conn = new this._polyfill(url, "json.webpubsub.azure.v1");
|
|
@@ -1068,6 +1075,7 @@ var WeaveStoreAzureWebPubSubSyncHost = class {
|
|
|
1068
1075
|
case MessageDataType.Init:
|
|
1069
1076
|
this.onClientInit(group, event.data);
|
|
1070
1077
|
this.onClientSync(group, event.data);
|
|
1078
|
+
this.sendInitAwarenessInfo();
|
|
1071
1079
|
return;
|
|
1072
1080
|
case MessageDataType.Sync:
|
|
1073
1081
|
this.onClientSync(group, event.data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/weave-store-azure-web-pubsub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"yjs": "13.6.26"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@inditextech/weave-sdk": "0.
|
|
65
|
+
"@inditextech/weave-sdk": "0.8.0",
|
|
66
66
|
"@types/express": "^5.0.1",
|
|
67
67
|
"@types/node": "^22.15.3",
|
|
68
68
|
"@types/uuid": "^10.0.0",
|