@netless/forge-rtm 1.0.10 → 1.1.0-beta.2
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/RTM_2_1.d.ts +8 -0
- package/dist/RTM_2_1.d.ts.map +1 -1
- package/dist/RTM_2_2.d.ts +9 -1
- package/dist/RTM_2_2.d.ts.map +1 -1
- package/dist/rtm-provider.esm.js +144 -1
- package/dist/rtm-provider.esm.js.map +3 -3
- package/dist/rtm-provider.js +144 -1
- package/dist/rtm-provider.js.map +3 -3
- package/package.json +2 -2
package/dist/RTM_2_1.d.ts
CHANGED
|
@@ -13,10 +13,14 @@ export declare class RTMProvider_2_1 extends EventEmitter<SocketProviderEvent> i
|
|
|
13
13
|
private rtmTimestamp;
|
|
14
14
|
private animationStartTimestamp?;
|
|
15
15
|
private animationId?;
|
|
16
|
+
private cachedWritable;
|
|
17
|
+
private isInitialized;
|
|
18
|
+
private userListCache;
|
|
16
19
|
get calibrationTimestamp(): number;
|
|
17
20
|
constructor(rtmClient: RTMClient);
|
|
18
21
|
private roomChannel;
|
|
19
22
|
private userChannel;
|
|
23
|
+
private writableChannel;
|
|
20
24
|
/**
|
|
21
25
|
* 重新订阅频道
|
|
22
26
|
*/
|
|
@@ -26,11 +30,15 @@ export declare class RTMProvider_2_1 extends EventEmitter<SocketProviderEvent> i
|
|
|
26
30
|
private isForgeRoomChannel;
|
|
27
31
|
private handleRtmMessage;
|
|
28
32
|
private calibrateAnimate;
|
|
33
|
+
private handleStorageEvent;
|
|
29
34
|
private handleStatus;
|
|
30
35
|
private handlePresence;
|
|
31
36
|
private receiveChunkMessage;
|
|
37
|
+
isUserOnline(userId: string): boolean;
|
|
32
38
|
publish(buf: Uint8Array, customType: string, target?: string): void;
|
|
33
39
|
userList(): Promise<Set<string>>;
|
|
34
40
|
historyMessage(_begin: number, _end: number): Promise<null>;
|
|
41
|
+
setUserWritable(writable: boolean, userId?: string): Promise<void>;
|
|
42
|
+
getUserWritable(userId?: string): Promise<boolean>;
|
|
35
43
|
}
|
|
36
44
|
//# sourceMappingURL=RTM_2_1.d.ts.map
|
package/dist/RTM_2_1.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTM_2_1.d.ts","sourceRoot":"","sources":["../src/RTM_2_1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAO,MAAM,qBAAqB,CAAC;AAC/E,OAAO,YAAY,MAAM,eAAe,CAAC;AAIzC,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AAItD,qBAAa,eAAgB,SAAQ,YAAY,CAAC,mBAAmB,CAAE,YAAW,cAAc;IAE9F,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAU;IAExB,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,eAAe,CAAkD;IACzE,OAAO,CAAC,cAAc,CAA8B;IAEpD,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,uBAAuB,CAAC,CAAS;IACzC,OAAO,CAAC,WAAW,CAAC,CAAS;
|
|
1
|
+
{"version":3,"file":"RTM_2_1.d.ts","sourceRoot":"","sources":["../src/RTM_2_1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAO,MAAM,qBAAqB,CAAC;AAC/E,OAAO,YAAY,MAAM,eAAe,CAAC;AAIzC,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AAItD,qBAAa,eAAgB,SAAQ,YAAY,CAAC,mBAAmB,CAAE,YAAW,cAAc;IAE9F,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAU;IAExB,OAAO,CAAC,gBAAgB,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C,IAAI,CAAC;IAYlE,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAchE"}
|
package/dist/RTM_2_2.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SocketProvider, SocketProviderEvent } from '@netless/forge-room';
|
|
2
2
|
import EventEmitter from 'eventemitter3';
|
|
3
|
-
import
|
|
3
|
+
import { RTMClient } from 'agora-rtm';
|
|
4
4
|
import type { HistoryMessage } from '@netless/forge-room';
|
|
5
5
|
export declare class RTMProvider_2_2 extends EventEmitter<SocketProviderEvent> implements SocketProvider {
|
|
6
6
|
private rtmClient;
|
|
@@ -15,9 +15,13 @@ export declare class RTMProvider_2_2 extends EventEmitter<SocketProviderEvent> i
|
|
|
15
15
|
private rtmTimestamp;
|
|
16
16
|
private animationStartTimestamp?;
|
|
17
17
|
private animationId?;
|
|
18
|
+
private cachedWritable;
|
|
19
|
+
private isInitialized;
|
|
20
|
+
private userListCache;
|
|
18
21
|
get calibrationTimestamp(): number;
|
|
19
22
|
constructor(rtmClient: RTMClient);
|
|
20
23
|
private roomChannel;
|
|
24
|
+
private writableChannel;
|
|
21
25
|
private userChannel;
|
|
22
26
|
initialize(roomId: string, userId: string): Promise<void>;
|
|
23
27
|
/**
|
|
@@ -28,12 +32,16 @@ export declare class RTMProvider_2_2 extends EventEmitter<SocketProviderEvent> i
|
|
|
28
32
|
private isForgeRoomChannel;
|
|
29
33
|
private handleRtmMessage;
|
|
30
34
|
private calibrateAnimate;
|
|
35
|
+
private handleStorageEvent;
|
|
31
36
|
private handleStatus;
|
|
32
37
|
private handlePresence;
|
|
33
38
|
private receiveChunkMessage;
|
|
39
|
+
isUserOnline(userId: string): boolean;
|
|
34
40
|
publish(buf: Uint8Array, customType: string, target?: string): void;
|
|
35
41
|
userList(): Promise<Set<string>>;
|
|
36
42
|
private fetchHistoryMessage;
|
|
37
43
|
historyMessage(begin: number, end: number): Promise<HistoryMessage[] | null>;
|
|
44
|
+
setUserWritable(writable: boolean, userId?: string): Promise<void>;
|
|
45
|
+
getUserWritable(userId?: string): Promise<boolean>;
|
|
38
46
|
}
|
|
39
47
|
//# sourceMappingURL=RTM_2_2.d.ts.map
|
package/dist/RTM_2_2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RTM_2_2.d.ts","sourceRoot":"","sources":["../src/RTM_2_2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAO,MAAM,qBAAqB,CAAC;AAC/E,OAAO,YAAY,MAAM,eAAe,CAAC;AAKzC,OAAO,
|
|
1
|
+
{"version":3,"file":"RTM_2_2.d.ts","sourceRoot":"","sources":["../src/RTM_2_2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAO,MAAM,qBAAqB,CAAC;AAC/E,OAAO,YAAY,MAAM,eAAe,CAAC;AAKzC,OAAO,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,YAAY,CAAC,mBAAmB,CAAE,YAAW,cAAc;IAE9F,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAU;IAExB,OAAO,CAAC,gBAAgB,CAAa;IAErC,OAAO,CAAC,eAAe,CAAkD;IACzE,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,2BAA2B,CAAa;IAEhD,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,uBAAuB,CAAC,CAAS;IACzC,OAAO,CAAC,WAAW,CAAC,CAAS;IAE7B,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,aAAa,CAAkB;IAEvC,OAAO,CAAC,aAAa,CAA0B;IAE/C,IAAW,oBAAoB,IAAI,MAAM,CAExC;gBAEkB,SAAS,EAAE,SAAS;IAKvC,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,WAAW;IAON,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDtE;;OAEG;IACU,WAAW;IAeX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAYrC,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,gBAAgB,CAoBtB;IAEF,OAAO,CAAC,gBAAgB,CAQtB;IAEF,OAAO,CAAC,kBAAkB,CAWxB;IAEF,OAAO,CAAC,YAAY,CA0BlB;IAEF,OAAO,CAAC,cAAc,CAepB;IAEF,OAAO,CAAC,mBAAmB;IAuBpB,YAAY,CAAC,MAAM,EAAC,MAAM,GAAG,OAAO;IAIpC,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW;IAgC1D,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAyB/B,mBAAmB;IAsDpB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC;IAY5E,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlE,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAehE"}
|
package/dist/rtm-provider.esm.js
CHANGED
|
@@ -125,6 +125,9 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
125
125
|
_defineProperty2(this, "rtmTimestamp", 0);
|
|
126
126
|
_defineProperty2(this, "animationStartTimestamp", void 0);
|
|
127
127
|
_defineProperty2(this, "animationId", void 0);
|
|
128
|
+
_defineProperty2(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
129
|
+
_defineProperty2(this, "isInitialized", false);
|
|
130
|
+
_defineProperty2(this, "userListCache", /* @__PURE__ */ new Set());
|
|
128
131
|
_defineProperty2(this, "handleRtmMessage", (evt) => {
|
|
129
132
|
try {
|
|
130
133
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -155,6 +158,17 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
155
158
|
this.animationId = requestAnimationFrame(this.calibrateAnimate);
|
|
156
159
|
}
|
|
157
160
|
});
|
|
161
|
+
_defineProperty2(this, "handleStorageEvent", (storageData) => {
|
|
162
|
+
if (storageData.channelName === this.writableChannel()) {
|
|
163
|
+
const writableStates = {};
|
|
164
|
+
const metadata = storageData.data.metadata;
|
|
165
|
+
for (const userId in metadata) {
|
|
166
|
+
const value = metadata[userId].value;
|
|
167
|
+
writableStates[userId] = value === "true";
|
|
168
|
+
}
|
|
169
|
+
this.emit("writableChanged", writableStates);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
158
172
|
_defineProperty2(this, "handleStatus", (connectionStatus) => {
|
|
159
173
|
log("rtm status update", {
|
|
160
174
|
state: connectionStatus.state,
|
|
@@ -180,10 +194,13 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
180
194
|
_defineProperty2(this, "handlePresence", (evt) => {
|
|
181
195
|
if (evt.channelName === this.roomChannel()) {
|
|
182
196
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
197
|
+
this.userListCache.add(evt.publisher);
|
|
183
198
|
this.emit("userJoin", evt.publisher);
|
|
184
199
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
200
|
+
this.userListCache.delete(evt.publisher);
|
|
185
201
|
this.emit("userLeave", evt.publisher);
|
|
186
202
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
203
|
+
this.userListCache.delete(evt.publisher);
|
|
187
204
|
this.emit("userLeave", evt.publisher);
|
|
188
205
|
} else if (evt.eventType === "INTERVAL") {
|
|
189
206
|
}
|
|
@@ -200,6 +217,9 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
200
217
|
}
|
|
201
218
|
return `${this.roomChannel()}_u_${userId}`;
|
|
202
219
|
}
|
|
220
|
+
writableChannel() {
|
|
221
|
+
return "userWritable";
|
|
222
|
+
}
|
|
203
223
|
/**
|
|
204
224
|
* 重新订阅频道
|
|
205
225
|
*/
|
|
@@ -207,6 +227,9 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
207
227
|
try {
|
|
208
228
|
await this.rtmClient.subscribe(this.roomChannel());
|
|
209
229
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
230
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
231
|
+
withMetadata: true
|
|
232
|
+
});
|
|
210
233
|
} catch (error) {
|
|
211
234
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
212
235
|
log("rtm subscribe fail", {
|
|
@@ -221,9 +244,13 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
221
244
|
this.rtmClient.addEventListener("message", this.handleRtmMessage);
|
|
222
245
|
this.rtmClient.addEventListener("presence", this.handlePresence);
|
|
223
246
|
this.rtmClient.addEventListener("status", this.handleStatus);
|
|
247
|
+
this.rtmClient.addEventListener("storage", this.handleStorageEvent);
|
|
224
248
|
try {
|
|
225
249
|
await this.rtmClient.subscribe(this.roomChannel());
|
|
226
250
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
251
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
252
|
+
withMetadata: true
|
|
253
|
+
});
|
|
227
254
|
} catch (error) {
|
|
228
255
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
229
256
|
log("rtm subscribe fail", {
|
|
@@ -231,6 +258,18 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
231
258
|
}, "error");
|
|
232
259
|
throw error;
|
|
233
260
|
}
|
|
261
|
+
this.isInitialized = true;
|
|
262
|
+
if (this.cachedWritable.size > 0) {
|
|
263
|
+
const writableData = Array.from(this.cachedWritable.entries()).map((_ref) => {
|
|
264
|
+
let [userId2, writable] = _ref;
|
|
265
|
+
return {
|
|
266
|
+
key: userId2,
|
|
267
|
+
value: writable ? "true" : "false"
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", writableData);
|
|
271
|
+
this.cachedWritable.clear();
|
|
272
|
+
}
|
|
234
273
|
this.intervalId = setInterval(() => {
|
|
235
274
|
const msg = this.cachedMessages.shift();
|
|
236
275
|
if (msg) {
|
|
@@ -250,9 +289,11 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
250
289
|
async dispose() {
|
|
251
290
|
this.rtmClient.removeEventListener("message", this.handleRtmMessage);
|
|
252
291
|
this.rtmClient.removeEventListener("presence", this.handlePresence);
|
|
292
|
+
this.rtmClient.removeEventListener("storage", this.handleStorageEvent);
|
|
253
293
|
this.rtmClient.removeEventListener("status", this.handleStatus);
|
|
254
294
|
await this.rtmClient.unsubscribe(this.roomChannel());
|
|
255
295
|
await this.rtmClient.unsubscribe(this.userChannel(this.userId));
|
|
296
|
+
await this.rtmClient.unsubscribe(this.writableChannel());
|
|
256
297
|
window.clearInterval(this.intervalId);
|
|
257
298
|
}
|
|
258
299
|
isForgeRoomChannel(channel) {
|
|
@@ -279,6 +320,9 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
279
320
|
this.chunkedMessages.set(msg.session, chunks);
|
|
280
321
|
}
|
|
281
322
|
}
|
|
323
|
+
isUserOnline(userId) {
|
|
324
|
+
return this.userListCache.has(userId);
|
|
325
|
+
}
|
|
282
326
|
publish(buf, customType) {
|
|
283
327
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
284
328
|
const chunkStep = 24;
|
|
@@ -331,11 +375,37 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
331
375
|
output.add(userId);
|
|
332
376
|
});
|
|
333
377
|
}
|
|
378
|
+
this.userListCache = this.userListCache.union(output);
|
|
334
379
|
return output;
|
|
335
380
|
}
|
|
336
381
|
async historyMessage(_begin, _end) {
|
|
337
382
|
return null;
|
|
338
383
|
}
|
|
384
|
+
async setUserWritable(writable, userId) {
|
|
385
|
+
const targetUserId = userId || this.userId;
|
|
386
|
+
if (!this.isInitialized) {
|
|
387
|
+
this.cachedWritable.set(targetUserId, writable);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", [{
|
|
391
|
+
key: targetUserId,
|
|
392
|
+
value: writable ? "true" : "false"
|
|
393
|
+
}]);
|
|
394
|
+
}
|
|
395
|
+
async getUserWritable(userId) {
|
|
396
|
+
const targetUserId = userId || this.userId;
|
|
397
|
+
try {
|
|
398
|
+
const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), "MESSAGE");
|
|
399
|
+
const value = channelMeta.metadata[targetUserId]?.value;
|
|
400
|
+
return value === "true";
|
|
401
|
+
} catch (error) {
|
|
402
|
+
log("getUserWritable failed", {
|
|
403
|
+
error: error.toString(),
|
|
404
|
+
userId: targetUserId
|
|
405
|
+
}, "warn");
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
339
409
|
};
|
|
340
410
|
|
|
341
411
|
// src/RTM_2_2.ts
|
|
@@ -377,6 +447,9 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
377
447
|
_defineProperty3(this, "rtmTimestamp", 0);
|
|
378
448
|
_defineProperty3(this, "animationStartTimestamp", void 0);
|
|
379
449
|
_defineProperty3(this, "animationId", void 0);
|
|
450
|
+
_defineProperty3(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
451
|
+
_defineProperty3(this, "isInitialized", false);
|
|
452
|
+
_defineProperty3(this, "userListCache", /* @__PURE__ */ new Set());
|
|
380
453
|
_defineProperty3(this, "handleRtmMessage", (evt) => {
|
|
381
454
|
try {
|
|
382
455
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -407,6 +480,17 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
407
480
|
this.animationId = requestAnimationFrame(this.calibrateAnimate);
|
|
408
481
|
}
|
|
409
482
|
});
|
|
483
|
+
_defineProperty3(this, "handleStorageEvent", (storageData) => {
|
|
484
|
+
if (storageData.channelName === this.writableChannel()) {
|
|
485
|
+
const writableStates = {};
|
|
486
|
+
const metadata = storageData.data.metadata;
|
|
487
|
+
for (const userId in metadata) {
|
|
488
|
+
const value = metadata[userId].value;
|
|
489
|
+
writableStates[userId] = value === "true";
|
|
490
|
+
}
|
|
491
|
+
this.emit("writableChanged", writableStates);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
410
494
|
_defineProperty3(this, "handleStatus", (connectionStatus) => {
|
|
411
495
|
log2("rtm status update", {
|
|
412
496
|
state: connectionStatus.state,
|
|
@@ -437,10 +521,13 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
437
521
|
_defineProperty3(this, "handlePresence", (evt) => {
|
|
438
522
|
if (evt.channelName === this.roomChannel()) {
|
|
439
523
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
524
|
+
this.userListCache.add(evt.publisher);
|
|
440
525
|
this.emit("userJoin", evt.publisher);
|
|
441
526
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
527
|
+
this.userListCache.delete(evt.publisher);
|
|
442
528
|
this.emit("userLeave", evt.publisher);
|
|
443
529
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
530
|
+
this.userListCache.delete(evt.publisher);
|
|
444
531
|
this.emit("userLeave", evt.publisher);
|
|
445
532
|
} else if (evt.eventType === "INTERVAL") {
|
|
446
533
|
}
|
|
@@ -451,6 +538,9 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
451
538
|
roomChannel() {
|
|
452
539
|
return `r_${this.roomId}`;
|
|
453
540
|
}
|
|
541
|
+
writableChannel() {
|
|
542
|
+
return `${this.roomChannel()}_uw`;
|
|
543
|
+
}
|
|
454
544
|
userChannel(userId) {
|
|
455
545
|
if (userId.length > 16) {
|
|
456
546
|
userId = `${cyrb53(userId)}`;
|
|
@@ -464,9 +554,15 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
464
554
|
this.rtmClient.addEventListener("message", this.handleRtmMessage);
|
|
465
555
|
this.rtmClient.addEventListener("presence", this.handlePresence);
|
|
466
556
|
this.rtmClient.addEventListener("status", this.handleStatus);
|
|
557
|
+
this.rtmClient.addEventListener("storage", this.handleStorageEvent);
|
|
467
558
|
try {
|
|
468
|
-
await this.rtmClient.subscribe(this.roomChannel()
|
|
559
|
+
await this.rtmClient.subscribe(this.roomChannel(), {
|
|
560
|
+
withPresence: true
|
|
561
|
+
});
|
|
469
562
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
563
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
564
|
+
withMetadata: true
|
|
565
|
+
});
|
|
470
566
|
} catch (error) {
|
|
471
567
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
472
568
|
log2("rtm subscribe fail", {
|
|
@@ -492,6 +588,18 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
492
588
|
});
|
|
493
589
|
}
|
|
494
590
|
}, 32);
|
|
591
|
+
this.isInitialized = true;
|
|
592
|
+
if (this.cachedWritable.size > 0) {
|
|
593
|
+
const writableData = Array.from(this.cachedWritable.entries()).map((_ref) => {
|
|
594
|
+
let [userId2, writable] = _ref;
|
|
595
|
+
return {
|
|
596
|
+
key: userId2,
|
|
597
|
+
value: writable ? "true" : "false"
|
|
598
|
+
};
|
|
599
|
+
});
|
|
600
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", writableData);
|
|
601
|
+
this.cachedWritable.clear();
|
|
602
|
+
}
|
|
495
603
|
}
|
|
496
604
|
/**
|
|
497
605
|
* 重新订阅频道
|
|
@@ -500,6 +608,9 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
500
608
|
try {
|
|
501
609
|
await this.rtmClient.subscribe(this.roomChannel());
|
|
502
610
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
611
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
612
|
+
withMetadata: true
|
|
613
|
+
});
|
|
503
614
|
} catch (error) {
|
|
504
615
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
505
616
|
log2("rtm subscribe fail", {
|
|
@@ -510,9 +621,11 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
510
621
|
async dispose() {
|
|
511
622
|
this.rtmClient.removeEventListener("message", this.handleRtmMessage);
|
|
512
623
|
this.rtmClient.removeEventListener("presence", this.handlePresence);
|
|
624
|
+
this.rtmClient.removeEventListener("storage", this.handleStorageEvent);
|
|
513
625
|
this.rtmClient.removeEventListener("status", this.handleStatus);
|
|
514
626
|
await this.rtmClient.unsubscribe(this.roomChannel());
|
|
515
627
|
await this.rtmClient.unsubscribe(this.userChannel(this.userId));
|
|
628
|
+
await this.rtmClient.unsubscribe(this.writableChannel());
|
|
516
629
|
window.clearInterval(this.intervalId);
|
|
517
630
|
}
|
|
518
631
|
isForgeRoomChannel(channel) {
|
|
@@ -539,6 +652,9 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
539
652
|
this.chunkedMessages.set(msg.session, chunks);
|
|
540
653
|
}
|
|
541
654
|
}
|
|
655
|
+
isUserOnline(userId) {
|
|
656
|
+
return this.userListCache.has(userId);
|
|
657
|
+
}
|
|
542
658
|
publish(buf, customType) {
|
|
543
659
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
544
660
|
if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5e3) {
|
|
@@ -595,6 +711,7 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
595
711
|
output.add(userId);
|
|
596
712
|
});
|
|
597
713
|
}
|
|
714
|
+
this.userListCache = this.userListCache.union(output);
|
|
598
715
|
return output;
|
|
599
716
|
}
|
|
600
717
|
async fetchHistoryMessage(begin, end, channel) {
|
|
@@ -658,6 +775,32 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
658
775
|
return null;
|
|
659
776
|
}
|
|
660
777
|
}
|
|
778
|
+
async setUserWritable(writable, userId) {
|
|
779
|
+
const targetUserId = userId || this.userId;
|
|
780
|
+
if (!this.isInitialized) {
|
|
781
|
+
this.cachedWritable.set(targetUserId, writable);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", [{
|
|
785
|
+
key: targetUserId,
|
|
786
|
+
value: writable ? "true" : "false"
|
|
787
|
+
}]);
|
|
788
|
+
}
|
|
789
|
+
async getUserWritable(userId) {
|
|
790
|
+
const targetUserId = userId || this.userId;
|
|
791
|
+
try {
|
|
792
|
+
const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), "MESSAGE");
|
|
793
|
+
const value = channelMeta.metadata[targetUserId]?.value;
|
|
794
|
+
return value === "true";
|
|
795
|
+
} catch (error) {
|
|
796
|
+
log2("getUserWritable failed", {
|
|
797
|
+
error: error.toString(),
|
|
798
|
+
userId: targetUserId,
|
|
799
|
+
rtm: "2.2"
|
|
800
|
+
}, "warn");
|
|
801
|
+
return true;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
661
804
|
};
|
|
662
805
|
export {
|
|
663
806
|
RTMProvider_2_1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/RTM_2_1.ts", "../src/utils.ts", "../src/ChunkedUpdateMessage.ts", "../src/RTM_2_2.ts"],
|
|
4
|
-
"sourcesContent": ["function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_1 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n // console.log(\"rtm timestamp\", evt.timestamp, \"calibrationTimestamp\", this.calibrationTimestamp);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (error) {\n log('rtm handle message error', {\n error: error.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n throw error;\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n return output;\n }\n async historyMessage(_begin, _end) {\n return null;\n }\n}", "export const cyrb53 = function (str) {\n let seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);\n h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);\n h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);\n h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n};", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nexport class ChunkedUpdateMessage {\n static fromObject(obj, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.target = target;\n msg.customType = customType;\n const encoder = new TextEncoder();\n const sessionBuf = encoder.encode(obj.session);\n\n // header \u6309\u987A\u5E8F\u6307\u793A buf, session, target, customType \u90E8\u5206\u7684 uint8 \u957F\u5EA6\n msg.header = new DataView(new Uint8Array(10).buffer);\n msg.header.setUint32(0, obj.buf.length, false);\n msg.header.setUint32(4, sessionBuf.length, false);\n msg.header.setUint8(8, obj.index);\n msg.header.setUint8(9, obj.length);\n msg.buffer = new Uint8Array(obj.buf.length + sessionBuf.length + msg.header.buffer.byteLength);\n let len = 0;\n msg.buffer.set(new Uint8Array(msg.header.buffer), len);\n len += msg.header.buffer.byteLength;\n msg.buffer.set(obj.buf, len);\n len += obj.buf.length;\n msg.buffer.set(sessionBuf, len);\n return msg;\n }\n static fromBuffer(buf, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.header = new DataView(buf.slice(0, 10).buffer);\n msg.buffer = buf.slice(10);\n msg.target = target;\n msg.customType = customType;\n return msg;\n }\n get buf() {\n const len = this.header.getInt32(0);\n return this.buffer.slice(0, len);\n }\n get index() {\n return this.header.getUint8(8);\n }\n get length() {\n return this.header.getUint8(9);\n }\n get session() {\n const start = this.header.getInt32(0);\n const sessionBuf = this.buffer.slice(start, start + this.header.getInt32(4));\n const textDecoder = new TextDecoder();\n return textDecoder.decode(sessionBuf);\n }\n constructor() {\n _defineProperty(this, \"target\", void 0);\n _defineProperty(this, \"customType\", void 0);\n _defineProperty(this, \"buffer\", void 0);\n _defineProperty(this, \"header\", void 0);\n }\n}", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_2 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"lastCachedMessageReportTime\", 0);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (e) {\n log('rtm handle message error', {\n error: e.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason,\n rtm: '2.2'\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.emit('userLeave', this.userId);\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n this.emit('userJoin', this.userId);\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n this.emit('userLeave', this.userId);\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n this.emit('userLeave', this.userId);\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString(),\n rtm: '2.2'\n }, 'error');\n throw error;\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType,\n storeInHistory: true\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code,\n rtm: '2.2'\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5000) {\n log(`rtm cached message too many: ${this.cachedMessages.length}`, {}, 'warn');\n this.lastCachedMessageReportTime = Date.now();\n }\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n return output;\n }\n async fetchHistoryMessage(begin, end, channel) {\n let start = begin;\n let continueFetch = true;\n const output = [];\n while (continueFetch) {\n const response = await this.rtmClient.history.getMessages(channel, 'MESSAGE', {\n start: start,\n end: end\n });\n if (response.newStart !== 0) {\n start = response.newStart;\n } else {\n continueFetch = false;\n }\n const chunkedMessages = new Map();\n for (const msg of response.messageList) {\n const chunked = ChunkedUpdateMessage.fromBuffer(msg.message, msg.publisher, msg.customType);\n if (chunked.length === 1) {\n output.push({\n buf: chunked.buf,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n } else {\n const chunks = chunkedMessages.get(chunked.session) || [];\n chunks.push(chunked);\n if (chunks.length === chunked.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n output.push({\n buf: buffer,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n chunkedMessages.delete(chunked.session);\n } else {\n chunkedMessages.set(chunked.session, chunks);\n }\n }\n }\n }\n return output;\n }\n async historyMessage(begin, end) {\n try {\n const roomMessages = await this.fetchHistoryMessage(end, begin, this.roomChannel());\n const userMessages = await this.fetchHistoryMessage(end, begin, this.userChannel(this.userId));\n return roomMessages.concat(userMessages);\n } catch (error) {\n this.emit('error', 'rtm historyMessage not support: ' + error);\n console.warn('rtm historyMessage not support: ' + error);\n return null;\n }\n }\n}"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,WAAW;AACpB,OAAO,kBAAkB;AACzB,SAAS,MAAM,cAAc;;;ACLtB,IAAM,SAAS,SAAU,KAAK;AACnC,MAAI,OAAO,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAY,UAAU,CAAC,IAAI;AAC/E,MAAI,KAAK,aAAa,MACpB,KAAK,aAAa;AACpB,WAAS,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,KAAK;AACvC,SAAK,IAAI,WAAW,CAAC;AACrB,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAClC,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAAA,EACpC;AACA,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AAC1C,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AAC1C,SAAO,cAAc,UAAU,OAAO,OAAO;AAC/C;;;ACdA,SAAS,gBAAgB,GAAG,GAAG,GAAG;AAAE,UAAQ,IAAI,eAAe,CAAC,MAAM,IAAI,OAAO,eAAe,GAAG,GAAG,EAAE,OAAO,GAAG,YAAY,MAAI,cAAc,MAAI,UAAU,KAAG,CAAC,IAAI,EAAE,CAAC,IAAI,GAAG;AAAG;AACnL,SAAS,eAAe,GAAG;AAAE,MAAI,IAAI,aAAa,GAAG,QAAQ;AAAG,SAAO,YAAY,OAAO,IAAI,IAAI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A,EACT;AAAA,EACA,MAAM,eAAe,OAAO,KAAK;AAC/B,QAAI;AACF,YAAM,eAAe,MAAM,KAAK,oBAAoB,KAAK,OAAO,KAAK,YAAY,CAAC;AAClF,YAAM,eAAe,MAAM,KAAK,oBAAoB,KAAK,OAAO,KAAK,YAAY,KAAK,MAAM,CAAC;AAC7F,aAAO,aAAa,OAAO,YAAY;AAAA,IACzC,SAAS,OAAO;AACd,WAAK,KAAK,SAAS,qCAAqC,KAAK;AAC7D,cAAQ,KAAK,qCAAqC,KAAK;AACvD,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
|
-
"names": ["_defineProperty", "_toPropertyKey", "_toPrimitive", "result", "log", "EventEmitter", "uuidv4", "_defineProperty", "_toPropertyKey", "_toPrimitive", "EventEmitter", "log", "uuidv4", "result", "output"]
|
|
4
|
+
"sourcesContent": ["function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_1 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"cachedWritable\", new Map());\n _defineProperty(this, \"isInitialized\", false);\n _defineProperty(this, \"userListCache\", new Set());\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n // console.log(\"rtm timestamp\", evt.timestamp, \"calibrationTimestamp\", this.calibrationTimestamp);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (error) {\n log('rtm handle message error', {\n error: error.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStorageEvent\", storageData => {\n if (storageData.channelName === this.writableChannel()) {\n // \u5904\u7406 writable \u72B6\u6001\u53D8\u66F4\uFF0C\u7EC4\u7EC7\u6240\u6709\u4EBA\u7684 writable \u72B6\u6001\n const writableStates = {};\n const metadata = storageData.data.metadata;\n for (const userId in metadata) {\n const value = metadata[userId].value;\n writableStates[userId] = value === 'true';\n }\n this.emit('writableChanged', writableStates);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.userListCache.add(evt.publisher);\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n writableChannel() {\n return 'userWritable';\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n this.rtmClient.addEventListener('storage', this.handleStorageEvent);\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n throw error;\n }\n this.isInitialized = true;\n if (this.cachedWritable.size > 0) {\n const writableData = Array.from(this.cachedWritable.entries()).map(_ref => {\n let [userId, writable] = _ref;\n return {\n key: userId,\n value: writable ? 'true' : 'false'\n };\n });\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', writableData);\n this.cachedWritable.clear();\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n this.rtmClient.removeEventListener('storage', this.handleStorageEvent);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n await this.rtmClient.unsubscribe(this.writableChannel());\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n isUserOnline(userId) {\n return this.userListCache.has(userId);\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n this.userListCache = this.userListCache.union(output);\n return output;\n }\n async historyMessage(_begin, _end) {\n return null;\n }\n async setUserWritable(writable, userId) {\n // \u7F13\u5B58\u7684\u4F5C\u7528\u662F\u52A0\u5165\u9891\u9053\u4E4B\u540E\u624D\u80FD\u8C03\u7528 setChannelMetadata\uFF0C\u6240\u4EE5\u7F13\u5B58\u5E94\u8BE5\u5728\u52A0\u5165\u9891\u9053\u6210\u529F\u540E\u5220\u9664\n const targetUserId = userId || this.userId;\n if (!this.isInitialized) {\n this.cachedWritable.set(targetUserId, writable);\n return;\n }\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', [{\n key: targetUserId,\n value: writable ? 'true' : 'false'\n }]);\n }\n async getUserWritable(userId) {\n const targetUserId = userId || this.userId;\n try {\n const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), 'MESSAGE');\n const value = channelMeta.metadata[targetUserId]?.value;\n return value === 'true';\n } catch (error) {\n log('getUserWritable failed', {\n error: error.toString(),\n userId: targetUserId\n }, 'warn');\n return true;\n }\n }\n}", "export const cyrb53 = function (str) {\n let seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);\n h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);\n h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);\n h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n};", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nexport class ChunkedUpdateMessage {\n static fromObject(obj, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.target = target;\n msg.customType = customType;\n const encoder = new TextEncoder();\n const sessionBuf = encoder.encode(obj.session);\n\n // header \u6309\u987A\u5E8F\u6307\u793A buf, session, target, customType \u90E8\u5206\u7684 uint8 \u957F\u5EA6\n msg.header = new DataView(new Uint8Array(10).buffer);\n msg.header.setUint32(0, obj.buf.length, false);\n msg.header.setUint32(4, sessionBuf.length, false);\n msg.header.setUint8(8, obj.index);\n msg.header.setUint8(9, obj.length);\n msg.buffer = new Uint8Array(obj.buf.length + sessionBuf.length + msg.header.buffer.byteLength);\n let len = 0;\n msg.buffer.set(new Uint8Array(msg.header.buffer), len);\n len += msg.header.buffer.byteLength;\n msg.buffer.set(obj.buf, len);\n len += obj.buf.length;\n msg.buffer.set(sessionBuf, len);\n return msg;\n }\n static fromBuffer(buf, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.header = new DataView(buf.slice(0, 10).buffer);\n msg.buffer = buf.slice(10);\n msg.target = target;\n msg.customType = customType;\n return msg;\n }\n get buf() {\n const len = this.header.getInt32(0);\n return this.buffer.slice(0, len);\n }\n get index() {\n return this.header.getUint8(8);\n }\n get length() {\n return this.header.getUint8(9);\n }\n get session() {\n const start = this.header.getInt32(0);\n const sessionBuf = this.buffer.slice(start, start + this.header.getInt32(4));\n const textDecoder = new TextDecoder();\n return textDecoder.decode(sessionBuf);\n }\n constructor() {\n _defineProperty(this, \"target\", void 0);\n _defineProperty(this, \"customType\", void 0);\n _defineProperty(this, \"buffer\", void 0);\n _defineProperty(this, \"header\", void 0);\n }\n}", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_2 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"lastCachedMessageReportTime\", 0);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"cachedWritable\", new Map());\n _defineProperty(this, \"isInitialized\", false);\n _defineProperty(this, \"userListCache\", new Set());\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (e) {\n log('rtm handle message error', {\n error: e.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStorageEvent\", storageData => {\n if (storageData.channelName === this.writableChannel()) {\n // \u5904\u7406 writable \u72B6\u6001\u53D8\u66F4\uFF0C\u7EC4\u7EC7\u6240\u6709\u4EBA\u7684 writable \u72B6\u6001\n const writableStates = {};\n const metadata = storageData.data.metadata;\n for (const userId in metadata) {\n const value = metadata[userId].value;\n writableStates[userId] = value === 'true';\n }\n this.emit('writableChanged', writableStates);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason,\n rtm: '2.2'\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.emit('userLeave', this.userId);\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n this.emit('userJoin', this.userId);\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n this.emit('userLeave', this.userId);\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n this.emit('userLeave', this.userId);\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.userListCache.add(evt.publisher);\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n writableChannel() {\n return `${this.roomChannel()}_uw`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n this.rtmClient.addEventListener('storage', this.handleStorageEvent);\n try {\n await this.rtmClient.subscribe(this.roomChannel(), {\n withPresence: true\n });\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString(),\n rtm: '2.2'\n }, 'error');\n throw error;\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType,\n storeInHistory: true\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code,\n rtm: '2.2'\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n this.isInitialized = true;\n if (this.cachedWritable.size > 0) {\n const writableData = Array.from(this.cachedWritable.entries()).map(_ref => {\n let [userId, writable] = _ref;\n return {\n key: userId,\n value: writable ? 'true' : 'false'\n };\n });\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', writableData);\n this.cachedWritable.clear();\n }\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n this.rtmClient.removeEventListener('storage', this.handleStorageEvent);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n await this.rtmClient.unsubscribe(this.writableChannel());\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n isUserOnline(userId) {\n return this.userListCache.has(userId);\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5000) {\n log(`rtm cached message too many: ${this.cachedMessages.length}`, {}, 'warn');\n this.lastCachedMessageReportTime = Date.now();\n }\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n this.userListCache = this.userListCache.union(output);\n return output;\n }\n async fetchHistoryMessage(begin, end, channel) {\n let start = begin;\n let continueFetch = true;\n const output = [];\n while (continueFetch) {\n const response = await this.rtmClient.history.getMessages(channel, 'MESSAGE', {\n start: start,\n end: end\n });\n if (response.newStart !== 0) {\n start = response.newStart;\n } else {\n continueFetch = false;\n }\n const chunkedMessages = new Map();\n for (const msg of response.messageList) {\n const chunked = ChunkedUpdateMessage.fromBuffer(msg.message, msg.publisher, msg.customType);\n if (chunked.length === 1) {\n output.push({\n buf: chunked.buf,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n } else {\n const chunks = chunkedMessages.get(chunked.session) || [];\n chunks.push(chunked);\n if (chunks.length === chunked.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n output.push({\n buf: buffer,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n chunkedMessages.delete(chunked.session);\n } else {\n chunkedMessages.set(chunked.session, chunks);\n }\n }\n }\n }\n return output;\n }\n async historyMessage(begin, end) {\n try {\n const roomMessages = await this.fetchHistoryMessage(end, begin, this.roomChannel());\n const userMessages = await this.fetchHistoryMessage(end, begin, this.userChannel(this.userId));\n return roomMessages.concat(userMessages);\n } catch (error) {\n this.emit('error', 'rtm historyMessage not support: ' + error);\n console.warn('rtm historyMessage not support: ' + error);\n return null;\n }\n }\n async setUserWritable(writable, userId) {\n // \u7F13\u5B58\u7684\u4F5C\u7528\u662F\u52A0\u5165\u9891\u9053\u4E4B\u540E\u624D\u80FD\u8C03\u7528 setChannelMetadata\uFF0C\u6240\u4EE5\u7F13\u5B58\u5E94\u8BE5\u5728\u52A0\u5165\u9891\u9053\u6210\u529F\u540E\u5220\u9664\n const targetUserId = userId || this.userId;\n if (!this.isInitialized) {\n this.cachedWritable.set(targetUserId, writable);\n return;\n }\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', [{\n key: targetUserId,\n value: writable ? 'true' : 'false'\n }]);\n }\n async getUserWritable(userId) {\n const targetUserId = userId || this.userId;\n try {\n const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), 'MESSAGE');\n const value = channelMeta.metadata[targetUserId]?.value;\n return value === 'true';\n } catch (error) {\n log('getUserWritable failed', {\n error: error.toString(),\n userId: targetUserId,\n rtm: '2.2'\n }, 'warn');\n return true;\n }\n }\n}"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,WAAW;AACpB,OAAO,kBAAkB;AACzB,SAAS,MAAM,cAAc;;;ACLtB,IAAM,SAAS,SAAU,KAAK;AACnC,MAAI,OAAO,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAY,UAAU,CAAC,IAAI;AAC/E,MAAI,KAAK,aAAa,MACpB,KAAK,aAAa;AACpB,WAAS,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,KAAK;AACvC,SAAK,IAAI,WAAW,CAAC;AACrB,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAClC,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAAA,EACpC;AACA,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AAC1C,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AAC1C,SAAO,cAAc,UAAU,OAAO,OAAO;AAC/C;;;ACdA,SAAS,gBAAgB,GAAG,GAAG,GAAG;AAAE,UAAQ,IAAI,eAAe,CAAC,MAAM,IAAI,OAAO,eAAe,GAAG,GAAG,EAAE,OAAO,GAAG,YAAY,MAAI,cAAc,MAAI,UAAU,KAAG,CAAC,IAAI,EAAE,CAAC,IAAI,GAAG;AAAG;AACnL,SAAS,eAAe,GAAG;AAAE,MAAI,IAAI,aAAa,GAAG,QAAQ;AAAG,SAAO,YAAY,OAAO,IAAI,IAAI,IAAI;AAAI;AAC1G,SAAS,aAAa,GAAG,GAAG;AAAE,MAAI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AAK,YAAY,KAAK,MAAM,CAAC;AAC7F,aAAO,aAAa,OAAO,YAAY;AAAA,IACzC,SAAS,OAAO;AACd,WAAK,KAAK,SAAS,qCAAqC,KAAK;AAC7D,cAAQ,KAAK,qCAAqC,KAAK;AACvD,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,MAAM,gBAAgB,UAAU,QAAQ;AAEtC,UAAM,eAAe,UAAU,KAAK;AACpC,QAAI,CAAC,KAAK,eAAe;AACvB,WAAK,eAAe,IAAI,cAAc,QAAQ;AAC9C;AAAA,IACF;AACA,UAAM,KAAK,UAAU,QAAQ,mBAAmB,KAAK,gBAAgB,GAAG,WAAW,CAAC;AAAA,MAClF,KAAK;AAAA,MACL,OAAO,WAAW,SAAS;AAAA,IAC7B,CAAC,CAAC;AAAA,EACJ;AAAA,EACA,MAAM,gBAAgB,QAAQ;AAC5B,UAAM,eAAe,UAAU,KAAK;AACpC,QAAI;AACF,YAAM,cAAc,MAAM,KAAK,UAAU,QAAQ,mBAAmB,KAAK,gBAAgB,GAAG,SAAS;AACrG,YAAM,QAAQ,YAAY,SAAS,YAAY,GAAG;AAClD,aAAO,UAAU;AAAA,IACnB,SAAS,OAAO;AACd,MAAAJ,KAAI,0BAA0B;AAAA,QAC5B,OAAO,MAAM,SAAS;AAAA,QACtB,QAAQ;AAAA,QACR,KAAK;AAAA,MACP,GAAG,MAAM;AACT,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["_defineProperty", "_toPropertyKey", "_toPrimitive", "userId", "result", "log", "EventEmitter", "uuidv4", "_defineProperty", "_toPropertyKey", "_toPrimitive", "EventEmitter", "log", "userId", "uuidv4", "result", "output"]
|
|
7
7
|
}
|
package/dist/rtm-provider.js
CHANGED
|
@@ -162,6 +162,9 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
162
162
|
_defineProperty2(this, "rtmTimestamp", 0);
|
|
163
163
|
_defineProperty2(this, "animationStartTimestamp", void 0);
|
|
164
164
|
_defineProperty2(this, "animationId", void 0);
|
|
165
|
+
_defineProperty2(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
166
|
+
_defineProperty2(this, "isInitialized", false);
|
|
167
|
+
_defineProperty2(this, "userListCache", /* @__PURE__ */ new Set());
|
|
165
168
|
_defineProperty2(this, "handleRtmMessage", (evt) => {
|
|
166
169
|
try {
|
|
167
170
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -192,6 +195,17 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
192
195
|
this.animationId = requestAnimationFrame(this.calibrateAnimate);
|
|
193
196
|
}
|
|
194
197
|
});
|
|
198
|
+
_defineProperty2(this, "handleStorageEvent", (storageData) => {
|
|
199
|
+
if (storageData.channelName === this.writableChannel()) {
|
|
200
|
+
const writableStates = {};
|
|
201
|
+
const metadata = storageData.data.metadata;
|
|
202
|
+
for (const userId in metadata) {
|
|
203
|
+
const value = metadata[userId].value;
|
|
204
|
+
writableStates[userId] = value === "true";
|
|
205
|
+
}
|
|
206
|
+
this.emit("writableChanged", writableStates);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
195
209
|
_defineProperty2(this, "handleStatus", (connectionStatus) => {
|
|
196
210
|
(0, import_forge_room.log)("rtm status update", {
|
|
197
211
|
state: connectionStatus.state,
|
|
@@ -217,10 +231,13 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
217
231
|
_defineProperty2(this, "handlePresence", (evt) => {
|
|
218
232
|
if (evt.channelName === this.roomChannel()) {
|
|
219
233
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
234
|
+
this.userListCache.add(evt.publisher);
|
|
220
235
|
this.emit("userJoin", evt.publisher);
|
|
221
236
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
237
|
+
this.userListCache.delete(evt.publisher);
|
|
222
238
|
this.emit("userLeave", evt.publisher);
|
|
223
239
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
240
|
+
this.userListCache.delete(evt.publisher);
|
|
224
241
|
this.emit("userLeave", evt.publisher);
|
|
225
242
|
} else if (evt.eventType === "INTERVAL") {
|
|
226
243
|
}
|
|
@@ -237,6 +254,9 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
237
254
|
}
|
|
238
255
|
return `${this.roomChannel()}_u_${userId}`;
|
|
239
256
|
}
|
|
257
|
+
writableChannel() {
|
|
258
|
+
return "userWritable";
|
|
259
|
+
}
|
|
240
260
|
/**
|
|
241
261
|
* 重新订阅频道
|
|
242
262
|
*/
|
|
@@ -244,6 +264,9 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
244
264
|
try {
|
|
245
265
|
await this.rtmClient.subscribe(this.roomChannel());
|
|
246
266
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
267
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
268
|
+
withMetadata: true
|
|
269
|
+
});
|
|
247
270
|
} catch (error) {
|
|
248
271
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
249
272
|
(0, import_forge_room.log)("rtm subscribe fail", {
|
|
@@ -258,9 +281,13 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
258
281
|
this.rtmClient.addEventListener("message", this.handleRtmMessage);
|
|
259
282
|
this.rtmClient.addEventListener("presence", this.handlePresence);
|
|
260
283
|
this.rtmClient.addEventListener("status", this.handleStatus);
|
|
284
|
+
this.rtmClient.addEventListener("storage", this.handleStorageEvent);
|
|
261
285
|
try {
|
|
262
286
|
await this.rtmClient.subscribe(this.roomChannel());
|
|
263
287
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
288
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
289
|
+
withMetadata: true
|
|
290
|
+
});
|
|
264
291
|
} catch (error) {
|
|
265
292
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
266
293
|
(0, import_forge_room.log)("rtm subscribe fail", {
|
|
@@ -268,6 +295,18 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
268
295
|
}, "error");
|
|
269
296
|
throw error;
|
|
270
297
|
}
|
|
298
|
+
this.isInitialized = true;
|
|
299
|
+
if (this.cachedWritable.size > 0) {
|
|
300
|
+
const writableData = Array.from(this.cachedWritable.entries()).map((_ref) => {
|
|
301
|
+
let [userId2, writable] = _ref;
|
|
302
|
+
return {
|
|
303
|
+
key: userId2,
|
|
304
|
+
value: writable ? "true" : "false"
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", writableData);
|
|
308
|
+
this.cachedWritable.clear();
|
|
309
|
+
}
|
|
271
310
|
this.intervalId = setInterval(() => {
|
|
272
311
|
const msg = this.cachedMessages.shift();
|
|
273
312
|
if (msg) {
|
|
@@ -287,9 +326,11 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
287
326
|
async dispose() {
|
|
288
327
|
this.rtmClient.removeEventListener("message", this.handleRtmMessage);
|
|
289
328
|
this.rtmClient.removeEventListener("presence", this.handlePresence);
|
|
329
|
+
this.rtmClient.removeEventListener("storage", this.handleStorageEvent);
|
|
290
330
|
this.rtmClient.removeEventListener("status", this.handleStatus);
|
|
291
331
|
await this.rtmClient.unsubscribe(this.roomChannel());
|
|
292
332
|
await this.rtmClient.unsubscribe(this.userChannel(this.userId));
|
|
333
|
+
await this.rtmClient.unsubscribe(this.writableChannel());
|
|
293
334
|
window.clearInterval(this.intervalId);
|
|
294
335
|
}
|
|
295
336
|
isForgeRoomChannel(channel) {
|
|
@@ -316,6 +357,9 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
316
357
|
this.chunkedMessages.set(msg.session, chunks);
|
|
317
358
|
}
|
|
318
359
|
}
|
|
360
|
+
isUserOnline(userId) {
|
|
361
|
+
return this.userListCache.has(userId);
|
|
362
|
+
}
|
|
319
363
|
publish(buf, customType) {
|
|
320
364
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
321
365
|
const chunkStep = 24;
|
|
@@ -368,11 +412,37 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
368
412
|
output.add(userId);
|
|
369
413
|
});
|
|
370
414
|
}
|
|
415
|
+
this.userListCache = this.userListCache.union(output);
|
|
371
416
|
return output;
|
|
372
417
|
}
|
|
373
418
|
async historyMessage(_begin, _end) {
|
|
374
419
|
return null;
|
|
375
420
|
}
|
|
421
|
+
async setUserWritable(writable, userId) {
|
|
422
|
+
const targetUserId = userId || this.userId;
|
|
423
|
+
if (!this.isInitialized) {
|
|
424
|
+
this.cachedWritable.set(targetUserId, writable);
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", [{
|
|
428
|
+
key: targetUserId,
|
|
429
|
+
value: writable ? "true" : "false"
|
|
430
|
+
}]);
|
|
431
|
+
}
|
|
432
|
+
async getUserWritable(userId) {
|
|
433
|
+
const targetUserId = userId || this.userId;
|
|
434
|
+
try {
|
|
435
|
+
const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), "MESSAGE");
|
|
436
|
+
const value = channelMeta.metadata[targetUserId]?.value;
|
|
437
|
+
return value === "true";
|
|
438
|
+
} catch (error) {
|
|
439
|
+
(0, import_forge_room.log)("getUserWritable failed", {
|
|
440
|
+
error: error.toString(),
|
|
441
|
+
userId: targetUserId
|
|
442
|
+
}, "warn");
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
376
446
|
};
|
|
377
447
|
|
|
378
448
|
// src/RTM_2_2.ts
|
|
@@ -414,6 +484,9 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
414
484
|
_defineProperty3(this, "rtmTimestamp", 0);
|
|
415
485
|
_defineProperty3(this, "animationStartTimestamp", void 0);
|
|
416
486
|
_defineProperty3(this, "animationId", void 0);
|
|
487
|
+
_defineProperty3(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
488
|
+
_defineProperty3(this, "isInitialized", false);
|
|
489
|
+
_defineProperty3(this, "userListCache", /* @__PURE__ */ new Set());
|
|
417
490
|
_defineProperty3(this, "handleRtmMessage", (evt) => {
|
|
418
491
|
try {
|
|
419
492
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -444,6 +517,17 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
444
517
|
this.animationId = requestAnimationFrame(this.calibrateAnimate);
|
|
445
518
|
}
|
|
446
519
|
});
|
|
520
|
+
_defineProperty3(this, "handleStorageEvent", (storageData) => {
|
|
521
|
+
if (storageData.channelName === this.writableChannel()) {
|
|
522
|
+
const writableStates = {};
|
|
523
|
+
const metadata = storageData.data.metadata;
|
|
524
|
+
for (const userId in metadata) {
|
|
525
|
+
const value = metadata[userId].value;
|
|
526
|
+
writableStates[userId] = value === "true";
|
|
527
|
+
}
|
|
528
|
+
this.emit("writableChanged", writableStates);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
447
531
|
_defineProperty3(this, "handleStatus", (connectionStatus) => {
|
|
448
532
|
(0, import_forge_room2.log)("rtm status update", {
|
|
449
533
|
state: connectionStatus.state,
|
|
@@ -474,10 +558,13 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
474
558
|
_defineProperty3(this, "handlePresence", (evt) => {
|
|
475
559
|
if (evt.channelName === this.roomChannel()) {
|
|
476
560
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
561
|
+
this.userListCache.add(evt.publisher);
|
|
477
562
|
this.emit("userJoin", evt.publisher);
|
|
478
563
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
564
|
+
this.userListCache.delete(evt.publisher);
|
|
479
565
|
this.emit("userLeave", evt.publisher);
|
|
480
566
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
567
|
+
this.userListCache.delete(evt.publisher);
|
|
481
568
|
this.emit("userLeave", evt.publisher);
|
|
482
569
|
} else if (evt.eventType === "INTERVAL") {
|
|
483
570
|
}
|
|
@@ -488,6 +575,9 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
488
575
|
roomChannel() {
|
|
489
576
|
return `r_${this.roomId}`;
|
|
490
577
|
}
|
|
578
|
+
writableChannel() {
|
|
579
|
+
return `${this.roomChannel()}_uw`;
|
|
580
|
+
}
|
|
491
581
|
userChannel(userId) {
|
|
492
582
|
if (userId.length > 16) {
|
|
493
583
|
userId = `${cyrb53(userId)}`;
|
|
@@ -501,9 +591,15 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
501
591
|
this.rtmClient.addEventListener("message", this.handleRtmMessage);
|
|
502
592
|
this.rtmClient.addEventListener("presence", this.handlePresence);
|
|
503
593
|
this.rtmClient.addEventListener("status", this.handleStatus);
|
|
594
|
+
this.rtmClient.addEventListener("storage", this.handleStorageEvent);
|
|
504
595
|
try {
|
|
505
|
-
await this.rtmClient.subscribe(this.roomChannel()
|
|
596
|
+
await this.rtmClient.subscribe(this.roomChannel(), {
|
|
597
|
+
withPresence: true
|
|
598
|
+
});
|
|
506
599
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
600
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
601
|
+
withMetadata: true
|
|
602
|
+
});
|
|
507
603
|
} catch (error) {
|
|
508
604
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
509
605
|
(0, import_forge_room2.log)("rtm subscribe fail", {
|
|
@@ -529,6 +625,18 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
529
625
|
});
|
|
530
626
|
}
|
|
531
627
|
}, 32);
|
|
628
|
+
this.isInitialized = true;
|
|
629
|
+
if (this.cachedWritable.size > 0) {
|
|
630
|
+
const writableData = Array.from(this.cachedWritable.entries()).map((_ref) => {
|
|
631
|
+
let [userId2, writable] = _ref;
|
|
632
|
+
return {
|
|
633
|
+
key: userId2,
|
|
634
|
+
value: writable ? "true" : "false"
|
|
635
|
+
};
|
|
636
|
+
});
|
|
637
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", writableData);
|
|
638
|
+
this.cachedWritable.clear();
|
|
639
|
+
}
|
|
532
640
|
}
|
|
533
641
|
/**
|
|
534
642
|
* 重新订阅频道
|
|
@@ -537,6 +645,9 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
537
645
|
try {
|
|
538
646
|
await this.rtmClient.subscribe(this.roomChannel());
|
|
539
647
|
await this.rtmClient.subscribe(this.userChannel(this.userId));
|
|
648
|
+
await this.rtmClient.subscribe(this.writableChannel(), {
|
|
649
|
+
withMetadata: true
|
|
650
|
+
});
|
|
540
651
|
} catch (error) {
|
|
541
652
|
this.emit("error", `rtm subscribe fail, ${error}`);
|
|
542
653
|
(0, import_forge_room2.log)("rtm subscribe fail", {
|
|
@@ -547,9 +658,11 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
547
658
|
async dispose() {
|
|
548
659
|
this.rtmClient.removeEventListener("message", this.handleRtmMessage);
|
|
549
660
|
this.rtmClient.removeEventListener("presence", this.handlePresence);
|
|
661
|
+
this.rtmClient.removeEventListener("storage", this.handleStorageEvent);
|
|
550
662
|
this.rtmClient.removeEventListener("status", this.handleStatus);
|
|
551
663
|
await this.rtmClient.unsubscribe(this.roomChannel());
|
|
552
664
|
await this.rtmClient.unsubscribe(this.userChannel(this.userId));
|
|
665
|
+
await this.rtmClient.unsubscribe(this.writableChannel());
|
|
553
666
|
window.clearInterval(this.intervalId);
|
|
554
667
|
}
|
|
555
668
|
isForgeRoomChannel(channel) {
|
|
@@ -576,6 +689,9 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
576
689
|
this.chunkedMessages.set(msg.session, chunks);
|
|
577
690
|
}
|
|
578
691
|
}
|
|
692
|
+
isUserOnline(userId) {
|
|
693
|
+
return this.userListCache.has(userId);
|
|
694
|
+
}
|
|
579
695
|
publish(buf, customType) {
|
|
580
696
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
581
697
|
if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5e3) {
|
|
@@ -632,6 +748,7 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
632
748
|
output.add(userId);
|
|
633
749
|
});
|
|
634
750
|
}
|
|
751
|
+
this.userListCache = this.userListCache.union(output);
|
|
635
752
|
return output;
|
|
636
753
|
}
|
|
637
754
|
async fetchHistoryMessage(begin, end, channel) {
|
|
@@ -695,5 +812,31 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
695
812
|
return null;
|
|
696
813
|
}
|
|
697
814
|
}
|
|
815
|
+
async setUserWritable(writable, userId) {
|
|
816
|
+
const targetUserId = userId || this.userId;
|
|
817
|
+
if (!this.isInitialized) {
|
|
818
|
+
this.cachedWritable.set(targetUserId, writable);
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), "MESSAGE", [{
|
|
822
|
+
key: targetUserId,
|
|
823
|
+
value: writable ? "true" : "false"
|
|
824
|
+
}]);
|
|
825
|
+
}
|
|
826
|
+
async getUserWritable(userId) {
|
|
827
|
+
const targetUserId = userId || this.userId;
|
|
828
|
+
try {
|
|
829
|
+
const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), "MESSAGE");
|
|
830
|
+
const value = channelMeta.metadata[targetUserId]?.value;
|
|
831
|
+
return value === "true";
|
|
832
|
+
} catch (error) {
|
|
833
|
+
(0, import_forge_room2.log)("getUserWritable failed", {
|
|
834
|
+
error: error.toString(),
|
|
835
|
+
userId: targetUserId,
|
|
836
|
+
rtm: "2.2"
|
|
837
|
+
}, "warn");
|
|
838
|
+
return true;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
698
841
|
};
|
|
699
842
|
//# sourceMappingURL=rtm-provider.js.map
|
package/dist/rtm-provider.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/RTM_2_1.ts", "../src/utils.ts", "../src/ChunkedUpdateMessage.ts", "../src/RTM_2_2.ts"],
|
|
4
|
-
"sourcesContent": ["export { RTMProvider_2_1 } from './RTM_2_1';\nexport { RTMProvider_2_2 } from './RTM_2_2';", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_1 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n // console.log(\"rtm timestamp\", evt.timestamp, \"calibrationTimestamp\", this.calibrationTimestamp);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (error) {\n log('rtm handle message error', {\n error: error.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n throw error;\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n return output;\n }\n async historyMessage(_begin, _end) {\n return null;\n }\n}", "export const cyrb53 = function (str) {\n let seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);\n h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);\n h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);\n h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n};", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nexport class ChunkedUpdateMessage {\n static fromObject(obj, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.target = target;\n msg.customType = customType;\n const encoder = new TextEncoder();\n const sessionBuf = encoder.encode(obj.session);\n\n // header \u6309\u987A\u5E8F\u6307\u793A buf, session, target, customType \u90E8\u5206\u7684 uint8 \u957F\u5EA6\n msg.header = new DataView(new Uint8Array(10).buffer);\n msg.header.setUint32(0, obj.buf.length, false);\n msg.header.setUint32(4, sessionBuf.length, false);\n msg.header.setUint8(8, obj.index);\n msg.header.setUint8(9, obj.length);\n msg.buffer = new Uint8Array(obj.buf.length + sessionBuf.length + msg.header.buffer.byteLength);\n let len = 0;\n msg.buffer.set(new Uint8Array(msg.header.buffer), len);\n len += msg.header.buffer.byteLength;\n msg.buffer.set(obj.buf, len);\n len += obj.buf.length;\n msg.buffer.set(sessionBuf, len);\n return msg;\n }\n static fromBuffer(buf, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.header = new DataView(buf.slice(0, 10).buffer);\n msg.buffer = buf.slice(10);\n msg.target = target;\n msg.customType = customType;\n return msg;\n }\n get buf() {\n const len = this.header.getInt32(0);\n return this.buffer.slice(0, len);\n }\n get index() {\n return this.header.getUint8(8);\n }\n get length() {\n return this.header.getUint8(9);\n }\n get session() {\n const start = this.header.getInt32(0);\n const sessionBuf = this.buffer.slice(start, start + this.header.getInt32(4));\n const textDecoder = new TextDecoder();\n return textDecoder.decode(sessionBuf);\n }\n constructor() {\n _defineProperty(this, \"target\", void 0);\n _defineProperty(this, \"customType\", void 0);\n _defineProperty(this, \"buffer\", void 0);\n _defineProperty(this, \"header\", void 0);\n }\n}", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_2 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"lastCachedMessageReportTime\", 0);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (e) {\n log('rtm handle message error', {\n error: e.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason,\n rtm: '2.2'\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.emit('userLeave', this.userId);\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n this.emit('userJoin', this.userId);\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n this.emit('userLeave', this.userId);\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n this.emit('userLeave', this.userId);\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString(),\n rtm: '2.2'\n }, 'error');\n throw error;\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType,\n storeInHistory: true\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code,\n rtm: '2.2'\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5000) {\n log(`rtm cached message too many: ${this.cachedMessages.length}`, {}, 'warn');\n this.lastCachedMessageReportTime = Date.now();\n }\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n return output;\n }\n async fetchHistoryMessage(begin, end, channel) {\n let start = begin;\n let continueFetch = true;\n const output = [];\n while (continueFetch) {\n const response = await this.rtmClient.history.getMessages(channel, 'MESSAGE', {\n start: start,\n end: end\n });\n if (response.newStart !== 0) {\n start = response.newStart;\n } else {\n continueFetch = false;\n }\n const chunkedMessages = new Map();\n for (const msg of response.messageList) {\n const chunked = ChunkedUpdateMessage.fromBuffer(msg.message, msg.publisher, msg.customType);\n if (chunked.length === 1) {\n output.push({\n buf: chunked.buf,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n } else {\n const chunks = chunkedMessages.get(chunked.session) || [];\n chunks.push(chunked);\n if (chunks.length === chunked.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n output.push({\n buf: buffer,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n chunkedMessages.delete(chunked.session);\n } else {\n chunkedMessages.set(chunked.session, chunks);\n }\n }\n }\n }\n return output;\n }\n async historyMessage(begin, end) {\n try {\n const roomMessages = await this.fetchHistoryMessage(end, begin, this.roomChannel());\n const userMessages = await this.fetchHistoryMessage(end, begin, this.userChannel(this.userId));\n return roomMessages.concat(userMessages);\n } catch (error) {\n this.emit('error', 'rtm historyMessage not support: ' + error);\n console.warn('rtm historyMessage not support: ' + error);\n return null;\n }\n }\n}"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,wBAAoB;AACpB,2BAAyB;AACzB,kBAA6B;;;ACLtB,IAAM,SAAS,SAAU,KAAK;AACnC,MAAI,OAAO,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAY,UAAU,CAAC,IAAI;AAC/E,MAAI,KAAK,aAAa,MACpB,KAAK,aAAa;AACpB,WAAS,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,KAAK;AACvC,SAAK,IAAI,WAAW,CAAC;AACrB,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAClC,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAAA,EACpC;AACA,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AAC1C,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UA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AAC7B,qBAAOA;AAAA,YACT,GAAG,IAAI,WAAW,CAAC;AACnB,mBAAO,KAAK;AAAA,cACV,KAAK;AAAA,cACL,WAAW,IAAI;AAAA,cACf,YAAY,IAAI;AAAA,cAChB,eAAe,YAAY,KAAK,YAAY;AAAA,YAC9C,CAAC;AACD,4BAAgB,OAAO,QAAQ,OAAO;AAAA,UACxC,OAAO;AACL,4BAAgB,IAAI,QAAQ,SAAS,MAAM;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EACA,MAAM,eAAe,OAAO,KAAK;AAC/B,QAAI;AACF,YAAM,eAAe,MAAM,KAAK,oBAAoB,KAAK,OAAO,KAAK,YAAY,CAAC;AAClF,YAAM,eAAe,MAAM,KAAK,oBAAoB,KAAK,OAAO,KAAK,YAAY,KAAK,MAAM,CAAC;AAC7F,aAAO,aAAa,OAAO,YAAY;AAAA,IACzC,SAAS,OAAO;AACd,WAAK,KAAK,SAAS,qCAAqC,KAAK;AAC7D,cAAQ,KAAK,qCAAqC,KAAK;AACvD,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
|
-
"names": ["_defineProperty", "_toPropertyKey", "_toPrimitive", "EventEmitter", "uuidv4", "result", "import_forge_room", "import_eventemitter3", "import_uuid", "_defineProperty", "_toPropertyKey", "_toPrimitive", "EventEmitter", "uuidv4", "result", "output"]
|
|
4
|
+
"sourcesContent": ["export { RTMProvider_2_1 } from './RTM_2_1';\nexport { RTMProvider_2_2 } from './RTM_2_2';", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_1 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"cachedWritable\", new Map());\n _defineProperty(this, \"isInitialized\", false);\n _defineProperty(this, \"userListCache\", new Set());\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n // console.log(\"rtm timestamp\", evt.timestamp, \"calibrationTimestamp\", this.calibrationTimestamp);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (error) {\n log('rtm handle message error', {\n error: error.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStorageEvent\", storageData => {\n if (storageData.channelName === this.writableChannel()) {\n // \u5904\u7406 writable \u72B6\u6001\u53D8\u66F4\uFF0C\u7EC4\u7EC7\u6240\u6709\u4EBA\u7684 writable \u72B6\u6001\n const writableStates = {};\n const metadata = storageData.data.metadata;\n for (const userId in metadata) {\n const value = metadata[userId].value;\n writableStates[userId] = value === 'true';\n }\n this.emit('writableChanged', writableStates);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.userListCache.add(evt.publisher);\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n writableChannel() {\n return 'userWritable';\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n this.rtmClient.addEventListener('storage', this.handleStorageEvent);\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n throw error;\n }\n this.isInitialized = true;\n if (this.cachedWritable.size > 0) {\n const writableData = Array.from(this.cachedWritable.entries()).map(_ref => {\n let [userId, writable] = _ref;\n return {\n key: userId,\n value: writable ? 'true' : 'false'\n };\n });\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', writableData);\n this.cachedWritable.clear();\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n this.rtmClient.removeEventListener('storage', this.handleStorageEvent);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n await this.rtmClient.unsubscribe(this.writableChannel());\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n isUserOnline(userId) {\n return this.userListCache.has(userId);\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n this.userListCache = this.userListCache.union(output);\n return output;\n }\n async historyMessage(_begin, _end) {\n return null;\n }\n async setUserWritable(writable, userId) {\n // \u7F13\u5B58\u7684\u4F5C\u7528\u662F\u52A0\u5165\u9891\u9053\u4E4B\u540E\u624D\u80FD\u8C03\u7528 setChannelMetadata\uFF0C\u6240\u4EE5\u7F13\u5B58\u5E94\u8BE5\u5728\u52A0\u5165\u9891\u9053\u6210\u529F\u540E\u5220\u9664\n const targetUserId = userId || this.userId;\n if (!this.isInitialized) {\n this.cachedWritable.set(targetUserId, writable);\n return;\n }\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', [{\n key: targetUserId,\n value: writable ? 'true' : 'false'\n }]);\n }\n async getUserWritable(userId) {\n const targetUserId = userId || this.userId;\n try {\n const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), 'MESSAGE');\n const value = channelMeta.metadata[targetUserId]?.value;\n return value === 'true';\n } catch (error) {\n log('getUserWritable failed', {\n error: error.toString(),\n userId: targetUserId\n }, 'warn');\n return true;\n }\n }\n}", "export const cyrb53 = function (str) {\n let seed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let h1 = 0xdeadbeef ^ seed,\n h2 = 0x41c6ce57 ^ seed;\n for (let i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);\n h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);\n h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);\n h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n};", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nexport class ChunkedUpdateMessage {\n static fromObject(obj, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.target = target;\n msg.customType = customType;\n const encoder = new TextEncoder();\n const sessionBuf = encoder.encode(obj.session);\n\n // header \u6309\u987A\u5E8F\u6307\u793A buf, session, target, customType \u90E8\u5206\u7684 uint8 \u957F\u5EA6\n msg.header = new DataView(new Uint8Array(10).buffer);\n msg.header.setUint32(0, obj.buf.length, false);\n msg.header.setUint32(4, sessionBuf.length, false);\n msg.header.setUint8(8, obj.index);\n msg.header.setUint8(9, obj.length);\n msg.buffer = new Uint8Array(obj.buf.length + sessionBuf.length + msg.header.buffer.byteLength);\n let len = 0;\n msg.buffer.set(new Uint8Array(msg.header.buffer), len);\n len += msg.header.buffer.byteLength;\n msg.buffer.set(obj.buf, len);\n len += obj.buf.length;\n msg.buffer.set(sessionBuf, len);\n return msg;\n }\n static fromBuffer(buf, target, customType) {\n const msg = new ChunkedUpdateMessage();\n msg.header = new DataView(buf.slice(0, 10).buffer);\n msg.buffer = buf.slice(10);\n msg.target = target;\n msg.customType = customType;\n return msg;\n }\n get buf() {\n const len = this.header.getInt32(0);\n return this.buffer.slice(0, len);\n }\n get index() {\n return this.header.getUint8(8);\n }\n get length() {\n return this.header.getUint8(9);\n }\n get session() {\n const start = this.header.getInt32(0);\n const sessionBuf = this.buffer.slice(start, start + this.header.getInt32(4));\n const textDecoder = new TextDecoder();\n return textDecoder.decode(sessionBuf);\n }\n constructor() {\n _defineProperty(this, \"target\", void 0);\n _defineProperty(this, \"customType\", void 0);\n _defineProperty(this, \"buffer\", void 0);\n _defineProperty(this, \"header\", void 0);\n }\n}", "function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == typeof i ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != typeof i) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nimport { log } from '@netless/forge-room';\nimport EventEmitter from 'eventemitter3';\nimport { v4 as uuidv4 } from 'uuid';\nimport { cyrb53 } from './utils';\nimport { ChunkedUpdateMessage } from './ChunkedUpdateMessage';\nexport class RTMProvider_2_2 extends EventEmitter {\n get calibrationTimestamp() {\n return this.rtmTimestamp + this.deviation;\n }\n constructor(rtmClient) {\n super();\n _defineProperty(this, \"rtmClient\", void 0);\n _defineProperty(this, \"roomId\", void 0);\n _defineProperty(this, \"userId\", void 0);\n _defineProperty(this, \"reconnectTimeout\", null);\n _defineProperty(this, \"chunkedMessages\", new Map());\n _defineProperty(this, \"cachedMessages\", []);\n _defineProperty(this, \"lastCachedMessageReportTime\", 0);\n _defineProperty(this, \"intervalId\", null);\n _defineProperty(this, \"deviation\", 0);\n _defineProperty(this, \"rtmTimestamp\", 0);\n _defineProperty(this, \"animationStartTimestamp\", void 0);\n _defineProperty(this, \"animationId\", void 0);\n _defineProperty(this, \"cachedWritable\", new Map());\n _defineProperty(this, \"isInitialized\", false);\n _defineProperty(this, \"userListCache\", new Set());\n _defineProperty(this, \"handleRtmMessage\", evt => {\n try {\n const isRoomChannel = evt.channelName.indexOf('_u_') < 0;\n if (!(evt.message instanceof Uint8Array) || !this.isForgeRoomChannel(evt.channelName)) {\n return;\n }\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationStartTimestamp = undefined;\n this.animationId = undefined;\n this.deviation = 0;\n }\n this.rtmTimestamp = evt.timestamp || Date.now();\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n this.receiveChunkMessage(ChunkedUpdateMessage.fromBuffer(evt.message, '', evt.customType), evt.publisher, isRoomChannel);\n } catch (e) {\n log('rtm handle message error', {\n error: e.toString()\n }, 'error');\n }\n });\n _defineProperty(this, \"calibrateAnimate\", timestamp => {\n if (this.animationStartTimestamp === undefined) {\n this.animationStartTimestamp = timestamp;\n }\n this.deviation = timestamp - this.animationStartTimestamp;\n if (this.animationId) {\n this.animationId = requestAnimationFrame(this.calibrateAnimate);\n }\n });\n _defineProperty(this, \"handleStorageEvent\", storageData => {\n if (storageData.channelName === this.writableChannel()) {\n // \u5904\u7406 writable \u72B6\u6001\u53D8\u66F4\uFF0C\u7EC4\u7EC7\u6240\u6709\u4EBA\u7684 writable \u72B6\u6001\n const writableStates = {};\n const metadata = storageData.data.metadata;\n for (const userId in metadata) {\n const value = metadata[userId].value;\n writableStates[userId] = value === 'true';\n }\n this.emit('writableChanged', writableStates);\n }\n });\n _defineProperty(this, \"handleStatus\", connectionStatus => {\n log('rtm status update', {\n state: connectionStatus.state,\n reason: connectionStatus.reason,\n rtm: '2.2'\n });\n if (connectionStatus.state === 'RECONNECTING' && this.reconnectTimeout === null) {\n this.emit('connectionStatusChange', 'RECONNECTING');\n this.emit('userLeave', this.userId);\n this.reconnectTimeout = window.setTimeout(() => {\n this.emit('error', 'reconnecting timeout');\n this.emit('connectionStatusChange', 'DISCONNECTED');\n }, 30 * 1000);\n } else if (connectionStatus.state === 'CONNECTED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('connectionStatusChange', 'CONNECTED');\n this.emit('userJoin', this.userId);\n } else if (connectionStatus.state === 'FAILED') {\n window.clearTimeout(this.reconnectTimeout);\n this.emit('error', `rtm connection failed, ${connectionStatus.reason}`);\n this.emit('connectionStatusChange', 'DISCONNECTED');\n this.emit('userLeave', this.userId);\n } else if (connectionStatus.state === 'CONNECTING') {\n this.emit('connectionStatusChange', 'CONNECTING');\n this.emit('userLeave', this.userId);\n }\n });\n _defineProperty(this, \"handlePresence\", evt => {\n if (evt.channelName === this.roomChannel()) {\n if (evt.eventType === 'REMOTE_JOIN') {\n this.userListCache.add(evt.publisher);\n this.emit('userJoin', evt.publisher);\n } else if (evt.eventType === 'REMOTE_LEAVE') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'REMOTE_TIMEOUT') {\n this.userListCache.delete(evt.publisher);\n this.emit('userLeave', evt.publisher);\n } else if (evt.eventType === 'INTERVAL') {\n // evt.interval.join.users\n }\n }\n });\n this.rtmClient = rtmClient;\n }\n roomChannel() {\n return `r_${this.roomId}`;\n }\n writableChannel() {\n return `${this.roomChannel()}_uw`;\n }\n userChannel(userId) {\n if (userId.length > 16) {\n userId = `${cyrb53(userId)}`;\n }\n return `${this.roomChannel()}_u_${userId}`;\n }\n async initialize(roomId, userId) {\n window.clearInterval(this.intervalId);\n this.roomId = roomId;\n this.userId = userId;\n this.rtmClient.addEventListener('message', this.handleRtmMessage);\n this.rtmClient.addEventListener('presence', this.handlePresence);\n // @ts-ignore\n this.rtmClient.addEventListener('status', this.handleStatus);\n this.rtmClient.addEventListener('storage', this.handleStorageEvent);\n try {\n await this.rtmClient.subscribe(this.roomChannel(), {\n withPresence: true\n });\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString(),\n rtm: '2.2'\n }, 'error');\n throw error;\n }\n this.intervalId = setInterval(() => {\n const msg = this.cachedMessages.shift();\n if (msg) {\n const channel = msg.target ? this.userChannel(msg.target) : this.roomChannel();\n this.rtmClient.publish(channel, msg.buffer, {\n customType: msg.customType,\n storeInHistory: true\n }).catch(error => {\n log('rtm publish failed', {\n channel,\n code: error.code,\n rtm: '2.2'\n }, 'warn');\n this.emit('error', `rtm publish fail, ${error}`);\n });\n }\n }, 32);\n this.isInitialized = true;\n if (this.cachedWritable.size > 0) {\n const writableData = Array.from(this.cachedWritable.entries()).map(_ref => {\n let [userId, writable] = _ref;\n return {\n key: userId,\n value: writable ? 'true' : 'false'\n };\n });\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', writableData);\n this.cachedWritable.clear();\n }\n }\n\n /**\n * \u91CD\u65B0\u8BA2\u9605\u9891\u9053\n */\n async resubscribe() {\n try {\n await this.rtmClient.subscribe(this.roomChannel());\n await this.rtmClient.subscribe(this.userChannel(this.userId));\n await this.rtmClient.subscribe(this.writableChannel(), {\n withMetadata: true\n });\n } catch (error) {\n this.emit('error', `rtm subscribe fail, ${error}`);\n log('rtm subscribe fail', {\n error: error.toString()\n }, 'error');\n }\n }\n async dispose() {\n this.rtmClient.removeEventListener('message', this.handleRtmMessage);\n this.rtmClient.removeEventListener('presence', this.handlePresence);\n this.rtmClient.removeEventListener('storage', this.handleStorageEvent);\n // @ts-ignore\n this.rtmClient.removeEventListener('status', this.handleStatus);\n await this.rtmClient.unsubscribe(this.roomChannel());\n await this.rtmClient.unsubscribe(this.userChannel(this.userId));\n await this.rtmClient.unsubscribe(this.writableChannel());\n window.clearInterval(this.intervalId);\n }\n isForgeRoomChannel(channel) {\n return channel === this.roomChannel() || channel === this.userChannel(this.userId);\n }\n receiveChunkMessage(msg, publisher, isRoomChannel) {\n if (msg.length === 1) {\n this.emit('message', msg.buf, publisher, msg.customType, isRoomChannel);\n return;\n }\n const chunks = this.chunkedMessages.get(msg.session) || [];\n chunks.push(msg);\n if (chunks.length === msg.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n this.emit('message', buffer, publisher, msg.customType, isRoomChannel);\n this.chunkedMessages.delete(msg.session);\n } else {\n this.chunkedMessages.set(msg.session, chunks);\n }\n }\n isUserOnline(userId) {\n return this.userListCache.has(userId);\n }\n publish(buf, customType) {\n let target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5000) {\n log(`rtm cached message too many: ${this.cachedMessages.length}`, {}, 'warn');\n this.lastCachedMessageReportTime = Date.now();\n }\n const chunkStep = 24;\n const session = uuidv4();\n // \u6D88\u606F\u5305\u4F53\u79EF, \u5355\u4F4D kb\n const size = buf.length * Uint8Array.BYTES_PER_ELEMENT / 1024;\n if (size < chunkStep) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf,\n length: 1,\n index: 0,\n session\n }, target, customType));\n } else {\n const chunkSize = chunkStep * 1024 / Uint8Array.BYTES_PER_ELEMENT;\n const len = Math.ceil(size / chunkStep);\n let index = 0;\n while (index < len) {\n this.cachedMessages.push(ChunkedUpdateMessage.fromObject({\n buf: buf.slice(index * chunkSize, (index + 1) * chunkSize),\n length: len,\n index: index,\n session\n }, target, customType));\n index += 1;\n }\n }\n }\n async userList() {\n const output = new Set();\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false\n });\n let nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n while (nextPage) {\n const result = await this.rtmClient.presence.whoNow(this.roomChannel(), 'MESSAGE', {\n includedState: false,\n page: nextPage\n });\n nextPage = result.nextPage;\n result.occupants.forEach(userInfo => {\n const {\n userId\n } = userInfo;\n output.add(userId);\n });\n }\n this.userListCache = this.userListCache.union(output);\n return output;\n }\n async fetchHistoryMessage(begin, end, channel) {\n let start = begin;\n let continueFetch = true;\n const output = [];\n while (continueFetch) {\n const response = await this.rtmClient.history.getMessages(channel, 'MESSAGE', {\n start: start,\n end: end\n });\n if (response.newStart !== 0) {\n start = response.newStart;\n } else {\n continueFetch = false;\n }\n const chunkedMessages = new Map();\n for (const msg of response.messageList) {\n const chunked = ChunkedUpdateMessage.fromBuffer(msg.message, msg.publisher, msg.customType);\n if (chunked.length === 1) {\n output.push({\n buf: chunked.buf,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n } else {\n const chunks = chunkedMessages.get(chunked.session) || [];\n chunks.push(chunked);\n if (chunks.length === chunked.length) {\n const buffer = chunks.sort((a, b) => a.index - b.index).reduce((result, next) => {\n const buf = next.buf;\n const output = new Uint8Array(result.length + buf.length);\n output.set(result, 0);\n output.set(buf, result.length);\n return output;\n }, new Uint8Array());\n output.push({\n buf: buffer,\n publisher: msg.publisher,\n customType: msg.customType,\n isRoomChannel: channel === this.roomChannel()\n });\n chunkedMessages.delete(chunked.session);\n } else {\n chunkedMessages.set(chunked.session, chunks);\n }\n }\n }\n }\n return output;\n }\n async historyMessage(begin, end) {\n try {\n const roomMessages = await this.fetchHistoryMessage(end, begin, this.roomChannel());\n const userMessages = await this.fetchHistoryMessage(end, begin, this.userChannel(this.userId));\n return roomMessages.concat(userMessages);\n } catch (error) {\n this.emit('error', 'rtm historyMessage not support: ' + error);\n console.warn('rtm historyMessage not support: ' + error);\n return null;\n }\n }\n async setUserWritable(writable, userId) {\n // \u7F13\u5B58\u7684\u4F5C\u7528\u662F\u52A0\u5165\u9891\u9053\u4E4B\u540E\u624D\u80FD\u8C03\u7528 setChannelMetadata\uFF0C\u6240\u4EE5\u7F13\u5B58\u5E94\u8BE5\u5728\u52A0\u5165\u9891\u9053\u6210\u529F\u540E\u5220\u9664\n const targetUserId = userId || this.userId;\n if (!this.isInitialized) {\n this.cachedWritable.set(targetUserId, writable);\n return;\n }\n await this.rtmClient.storage.setChannelMetadata(this.writableChannel(), 'MESSAGE', [{\n key: targetUserId,\n value: writable ? 'true' : 'false'\n }]);\n }\n async getUserWritable(userId) {\n const targetUserId = userId || this.userId;\n try {\n const channelMeta = await this.rtmClient.storage.getChannelMetadata(this.writableChannel(), 'MESSAGE');\n const value = channelMeta.metadata[targetUserId]?.value;\n return value === 'true';\n } catch (error) {\n log('getUserWritable failed', {\n error: error.toString(),\n userId: targetUserId,\n rtm: '2.2'\n }, 'warn');\n return true;\n }\n }\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,wBAAoB;AACpB,2BAAyB;AACzB,kBAA6B;;;ACLtB,IAAM,SAAS,SAAU,KAAK;AACnC,MAAI,OAAO,UAAU,SAAS,KAAK,UAAU,CAAC,MAAM,SAAY,UAAU,CAAC,IAAI;AAC/E,MAAI,KAAK,aAAa,MACpB,KAAK,aAAa;AACpB,WAAS,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,KAAK;AACvC,SAAK,IAAI,WAAW,CAAC;AACrB,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAClC,SAAK,KAAK,KAAK,KAAK,IAAI,UAAU;AAAA,EACpC;AACA,OAAK,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AACzC,QAAM,KAAK,KAAK,KAAK,OAAO,IAAI,UAAU;AAC1C,OAAK,KAAK,K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QAC5B,OAAO,MAAM,SAAS;AAAA,QACtB,QAAQ;AAAA,QACR,KAAK;AAAA,MACP,GAAG,MAAM;AACT,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["_defineProperty", "_toPropertyKey", "_toPrimitive", "EventEmitter", "userId", "uuidv4", "result", "import_forge_room", "import_eventemitter3", "import_uuid", "_defineProperty", "_toPropertyKey", "_toPrimitive", "EventEmitter", "userId", "uuidv4", "result", "output"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/forge-rtm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/rtm-provider.js",
|
|
6
6
|
"module": "dist/rtm-provider.esm.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"js-base64": "^3.7.7",
|
|
12
12
|
"eventemitter3": "^5.0.1",
|
|
13
13
|
"uuid": "^9.0.1",
|
|
14
|
-
"@netless/forge-room": "1.0.
|
|
14
|
+
"@netless/forge-room": "1.1.0-beta.2"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"author": "",
|