@netless/forge-rtm 1.1.0-beta.1 → 1.1.0-beta.3
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 +2 -0
- package/dist/RTM_2_1.d.ts.map +1 -1
- package/dist/RTM_2_2.d.ts +2 -0
- package/dist/RTM_2_2.d.ts.map +1 -1
- package/dist/rtm-provider.esm.js +16 -0
- package/dist/rtm-provider.esm.js.map +2 -2
- package/dist/rtm-provider.js +16 -0
- package/dist/rtm-provider.js.map +2 -2
- package/package.json +2 -2
package/dist/RTM_2_1.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class RTMProvider_2_1 extends EventEmitter<SocketProviderEvent> i
|
|
|
15
15
|
private animationId?;
|
|
16
16
|
private cachedWritable;
|
|
17
17
|
private isInitialized;
|
|
18
|
+
private userListCache;
|
|
18
19
|
get calibrationTimestamp(): number;
|
|
19
20
|
constructor(rtmClient: RTMClient);
|
|
20
21
|
private roomChannel;
|
|
@@ -33,6 +34,7 @@ export declare class RTMProvider_2_1 extends EventEmitter<SocketProviderEvent> i
|
|
|
33
34
|
private handleStatus;
|
|
34
35
|
private handlePresence;
|
|
35
36
|
private receiveChunkMessage;
|
|
37
|
+
isUserOnline(userId: string): boolean;
|
|
36
38
|
publish(buf: Uint8Array, customType: string, target?: string): void;
|
|
37
39
|
userList(): Promise<Set<string>>;
|
|
38
40
|
historyMessage(_begin: number, _end: number): Promise<null>;
|
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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CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,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;CAchE"}
|
package/dist/RTM_2_2.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare class RTMProvider_2_2 extends EventEmitter<SocketProviderEvent> i
|
|
|
17
17
|
private animationId?;
|
|
18
18
|
private cachedWritable;
|
|
19
19
|
private isInitialized;
|
|
20
|
+
private userListCache;
|
|
20
21
|
get calibrationTimestamp(): number;
|
|
21
22
|
constructor(rtmClient: RTMClient);
|
|
22
23
|
private roomChannel;
|
|
@@ -35,6 +36,7 @@ export declare class RTMProvider_2_2 extends EventEmitter<SocketProviderEvent> i
|
|
|
35
36
|
private handleStatus;
|
|
36
37
|
private handlePresence;
|
|
37
38
|
private receiveChunkMessage;
|
|
39
|
+
isUserOnline(userId: string): boolean;
|
|
38
40
|
publish(buf: Uint8Array, customType: string, target?: string): void;
|
|
39
41
|
userList(): Promise<Set<string>>;
|
|
40
42
|
private fetchHistoryMessage;
|
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,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,CA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,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
|
@@ -127,6 +127,7 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
127
127
|
_defineProperty2(this, "animationId", void 0);
|
|
128
128
|
_defineProperty2(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
129
129
|
_defineProperty2(this, "isInitialized", false);
|
|
130
|
+
_defineProperty2(this, "userListCache", /* @__PURE__ */ new Set());
|
|
130
131
|
_defineProperty2(this, "handleRtmMessage", (evt) => {
|
|
131
132
|
try {
|
|
132
133
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -193,10 +194,13 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
193
194
|
_defineProperty2(this, "handlePresence", (evt) => {
|
|
194
195
|
if (evt.channelName === this.roomChannel()) {
|
|
195
196
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
197
|
+
this.userListCache.add(evt.publisher);
|
|
196
198
|
this.emit("userJoin", evt.publisher);
|
|
197
199
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
200
|
+
this.userListCache.delete(evt.publisher);
|
|
198
201
|
this.emit("userLeave", evt.publisher);
|
|
199
202
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
203
|
+
this.userListCache.delete(evt.publisher);
|
|
200
204
|
this.emit("userLeave", evt.publisher);
|
|
201
205
|
} else if (evt.eventType === "INTERVAL") {
|
|
202
206
|
}
|
|
@@ -316,6 +320,9 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
316
320
|
this.chunkedMessages.set(msg.session, chunks);
|
|
317
321
|
}
|
|
318
322
|
}
|
|
323
|
+
isUserOnline(userId) {
|
|
324
|
+
return this.userListCache.has(userId);
|
|
325
|
+
}
|
|
319
326
|
publish(buf, customType) {
|
|
320
327
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
321
328
|
const chunkStep = 24;
|
|
@@ -368,6 +375,7 @@ var RTMProvider_2_1 = class extends EventEmitter {
|
|
|
368
375
|
output.add(userId);
|
|
369
376
|
});
|
|
370
377
|
}
|
|
378
|
+
this.userListCache = this.userListCache.union(output);
|
|
371
379
|
return output;
|
|
372
380
|
}
|
|
373
381
|
async historyMessage(_begin, _end) {
|
|
@@ -441,6 +449,7 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
441
449
|
_defineProperty3(this, "animationId", void 0);
|
|
442
450
|
_defineProperty3(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
443
451
|
_defineProperty3(this, "isInitialized", false);
|
|
452
|
+
_defineProperty3(this, "userListCache", /* @__PURE__ */ new Set());
|
|
444
453
|
_defineProperty3(this, "handleRtmMessage", (evt) => {
|
|
445
454
|
try {
|
|
446
455
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -512,10 +521,13 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
512
521
|
_defineProperty3(this, "handlePresence", (evt) => {
|
|
513
522
|
if (evt.channelName === this.roomChannel()) {
|
|
514
523
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
524
|
+
this.userListCache.add(evt.publisher);
|
|
515
525
|
this.emit("userJoin", evt.publisher);
|
|
516
526
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
527
|
+
this.userListCache.delete(evt.publisher);
|
|
517
528
|
this.emit("userLeave", evt.publisher);
|
|
518
529
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
530
|
+
this.userListCache.delete(evt.publisher);
|
|
519
531
|
this.emit("userLeave", evt.publisher);
|
|
520
532
|
} else if (evt.eventType === "INTERVAL") {
|
|
521
533
|
}
|
|
@@ -640,6 +652,9 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
640
652
|
this.chunkedMessages.set(msg.session, chunks);
|
|
641
653
|
}
|
|
642
654
|
}
|
|
655
|
+
isUserOnline(userId) {
|
|
656
|
+
return this.userListCache.has(userId);
|
|
657
|
+
}
|
|
643
658
|
publish(buf, customType) {
|
|
644
659
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
645
660
|
if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5e3) {
|
|
@@ -696,6 +711,7 @@ var RTMProvider_2_2 = class extends EventEmitter2 {
|
|
|
696
711
|
output.add(userId);
|
|
697
712
|
});
|
|
698
713
|
}
|
|
714
|
+
this.userListCache = this.userListCache.union(output);
|
|
699
715
|
return output;
|
|
700
716
|
}
|
|
701
717
|
async fetchHistoryMessage(begin, end, channel) {
|
|
@@ -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, \"cachedWritable\", new Map());\n _defineProperty(this, \"isInitialized\", false);\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.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 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 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 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, \"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.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 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 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 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,Y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;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;",
|
|
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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T;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
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
|
@@ -164,6 +164,7 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
164
164
|
_defineProperty2(this, "animationId", void 0);
|
|
165
165
|
_defineProperty2(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
166
166
|
_defineProperty2(this, "isInitialized", false);
|
|
167
|
+
_defineProperty2(this, "userListCache", /* @__PURE__ */ new Set());
|
|
167
168
|
_defineProperty2(this, "handleRtmMessage", (evt) => {
|
|
168
169
|
try {
|
|
169
170
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -230,10 +231,13 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
230
231
|
_defineProperty2(this, "handlePresence", (evt) => {
|
|
231
232
|
if (evt.channelName === this.roomChannel()) {
|
|
232
233
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
234
|
+
this.userListCache.add(evt.publisher);
|
|
233
235
|
this.emit("userJoin", evt.publisher);
|
|
234
236
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
237
|
+
this.userListCache.delete(evt.publisher);
|
|
235
238
|
this.emit("userLeave", evt.publisher);
|
|
236
239
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
240
|
+
this.userListCache.delete(evt.publisher);
|
|
237
241
|
this.emit("userLeave", evt.publisher);
|
|
238
242
|
} else if (evt.eventType === "INTERVAL") {
|
|
239
243
|
}
|
|
@@ -353,6 +357,9 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
353
357
|
this.chunkedMessages.set(msg.session, chunks);
|
|
354
358
|
}
|
|
355
359
|
}
|
|
360
|
+
isUserOnline(userId) {
|
|
361
|
+
return this.userListCache.has(userId);
|
|
362
|
+
}
|
|
356
363
|
publish(buf, customType) {
|
|
357
364
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
358
365
|
const chunkStep = 24;
|
|
@@ -405,6 +412,7 @@ var RTMProvider_2_1 = class extends import_eventemitter3.default {
|
|
|
405
412
|
output.add(userId);
|
|
406
413
|
});
|
|
407
414
|
}
|
|
415
|
+
this.userListCache = this.userListCache.union(output);
|
|
408
416
|
return output;
|
|
409
417
|
}
|
|
410
418
|
async historyMessage(_begin, _end) {
|
|
@@ -478,6 +486,7 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
478
486
|
_defineProperty3(this, "animationId", void 0);
|
|
479
487
|
_defineProperty3(this, "cachedWritable", /* @__PURE__ */ new Map());
|
|
480
488
|
_defineProperty3(this, "isInitialized", false);
|
|
489
|
+
_defineProperty3(this, "userListCache", /* @__PURE__ */ new Set());
|
|
481
490
|
_defineProperty3(this, "handleRtmMessage", (evt) => {
|
|
482
491
|
try {
|
|
483
492
|
const isRoomChannel = evt.channelName.indexOf("_u_") < 0;
|
|
@@ -549,10 +558,13 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
549
558
|
_defineProperty3(this, "handlePresence", (evt) => {
|
|
550
559
|
if (evt.channelName === this.roomChannel()) {
|
|
551
560
|
if (evt.eventType === "REMOTE_JOIN") {
|
|
561
|
+
this.userListCache.add(evt.publisher);
|
|
552
562
|
this.emit("userJoin", evt.publisher);
|
|
553
563
|
} else if (evt.eventType === "REMOTE_LEAVE") {
|
|
564
|
+
this.userListCache.delete(evt.publisher);
|
|
554
565
|
this.emit("userLeave", evt.publisher);
|
|
555
566
|
} else if (evt.eventType === "REMOTE_TIMEOUT") {
|
|
567
|
+
this.userListCache.delete(evt.publisher);
|
|
556
568
|
this.emit("userLeave", evt.publisher);
|
|
557
569
|
} else if (evt.eventType === "INTERVAL") {
|
|
558
570
|
}
|
|
@@ -677,6 +689,9 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
677
689
|
this.chunkedMessages.set(msg.session, chunks);
|
|
678
690
|
}
|
|
679
691
|
}
|
|
692
|
+
isUserOnline(userId) {
|
|
693
|
+
return this.userListCache.has(userId);
|
|
694
|
+
}
|
|
680
695
|
publish(buf, customType) {
|
|
681
696
|
let target = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
682
697
|
if (this.cachedMessages.length > 150 && Date.now() - this.lastCachedMessageReportTime > 5e3) {
|
|
@@ -733,6 +748,7 @@ var RTMProvider_2_2 = class extends import_eventemitter32.default {
|
|
|
733
748
|
output.add(userId);
|
|
734
749
|
});
|
|
735
750
|
}
|
|
751
|
+
this.userListCache = this.userListCache.union(output);
|
|
736
752
|
return output;
|
|
737
753
|
}
|
|
738
754
|
async fetchHistoryMessage(begin, end, channel) {
|
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, \"cachedWritable\", new Map());\n _defineProperty(this, \"isInitialized\", false);\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.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 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 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 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, \"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.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 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 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 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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AAM,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;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,kCAAI,0BAA0B;AAAA,QAC5B,OAAO,MAAM,SAAS;AAAA,QACtB,QAAQ;AAAA,QACR,KAAK;AAAA,MACP,GAAG,MAAM;AACT,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
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,U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c,MAAM,KAAK,UAAU,QAAQ,mBAAmB,KAAK,gBAAgB,GAAG,SAAS;AACrG,YAAM,QAAQ,YAAY,SAAS,YAAY,GAAG;AAClD,aAAO,UAAU;AAAA,IACnB,SAAS,OAAO;AACd,kCAAI,0BAA0B;AAAA,QAC5B,OAAO,MAAM,SAAS;AAAA,QACtB,QAAQ;AAAA,QACR,KAAK;AAAA,MACP,GAAG,MAAM;AACT,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
|
|
6
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.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.3",
|
|
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.1.0-beta.
|
|
14
|
+
"@netless/forge-room": "1.1.0-beta.3"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"author": "",
|