@kispi/chat 0.6.0 → 0.7.1
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/README.en.md +21 -4
- package/README.md +18 -4
- package/dist/index.cjs +55 -13
- package/dist/index.d.cts +35 -9
- package/dist/index.d.ts +35 -9
- package/dist/index.js +55 -13
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -42,7 +42,7 @@ is in the browser, the whole app is open.
|
|
|
42
42
|
|---|---|
|
|
43
43
|
| `connect()` | Connects. If already connected or connecting, it joins that attempt. Rejects on failure, but **retries continue in the background** (see below) |
|
|
44
44
|
| `close()` | Disconnects. This one does not reconnect. Call `connect()` to come back |
|
|
45
|
-
| `reconnect()` | **Re-authenticates**: calls `token()` again and replaces the socket. Room handles, subscriptions and `messages` are kept, and the state goes `open → reconnecting → open` (never `closed`). Use it after a nickname or avatar change (below) |
|
|
45
|
+
| `reconnect()` | **Re-authenticates**: calls `token()` again and replaces the socket. Room handles, subscriptions and `messages` are kept (**when the user changes, `messages` is dropped and refilled**), and the state goes `open → reconnecting → open` (never `closed`). Use it after a nickname or avatar change, and **when logging in or out switches the user** (below) |
|
|
46
46
|
| `room(roomId)` | Room handle. Same id, same object |
|
|
47
47
|
| `roomByKey(key)` | Handle for a room opened by key. The server tells you the id when you subscribe. **Does not create the room** — for a key that doesn't exist, `subscribe()` rejects with `not_found`. Rooms are created by the backend with `rooms.ensure()` |
|
|
48
48
|
| `rooms.list({cursor?, limit?})` | Rooms I'm a member of + unread + last message |
|
|
@@ -88,7 +88,7 @@ off()
|
|
|
88
88
|
| `reactionsOf(messageId, {emoji?, cursor?, limit?})` | Who reacted. **Each row is a (user, emoji) pair**, so one person can appear on several rows. `limit` defaults to 50, max 100; the last page's `cursor` is an empty string |
|
|
89
89
|
| `markRead(seq, {threadId?})` | Read cursor |
|
|
90
90
|
| `reads({userId?, cursor?, limit?})` | Read cursors, paged. `{reads: [{userId?, seq, threadId?, withdrawn?}], cursor}`. **`userId` narrows to one person** -- `reads({userId: chat.user.id})` recovers your own per-thread cursors. Stop when `cursor` is `''` |
|
|
91
|
-
| `typing({threadId?})` | Typing indicator. Does not throw. Pass `threadId` while writing a thread reply |
|
|
91
|
+
| `typing({threadId?})` | Typing indicator. Does not throw. **Call it on every input event** — the SDK sends at most once per second per room. Pass `threadId` while writing a thread reply |
|
|
92
92
|
| `join()` / `leave()` | Membership |
|
|
93
93
|
| `presenceList()` | Who is in this room right now |
|
|
94
94
|
|
|
@@ -114,7 +114,7 @@ The SDK emits three more that have no wire counterpart.
|
|
|
114
114
|
|---|---|
|
|
115
115
|
| `messages` | Every time the list changes. **A new array each time; an emitted array is never touched again** |
|
|
116
116
|
| `error` | Reading history or filling a gap failed. **The room resubscribes itself.** The retry button for a person is `subscribe()` |
|
|
117
|
-
| `reset` | The cursor was older than the retention period,
|
|
117
|
+
| `reset` | The list was discarded and refilled — the cursor was older than the retention period, or **the client reconnected as a different user** (below). **You must discard what you rendered** |
|
|
118
118
|
|
|
119
119
|
### Things to know
|
|
120
120
|
|
|
@@ -144,12 +144,20 @@ room.on('messages', m => (messages.value = m))
|
|
|
144
144
|
watching the room is there. Collecting names from message senders misses anyone who has not
|
|
145
145
|
spoken yet. If `users` is absent (a room over 100), fetch it once with `presenceList()`, and fall
|
|
146
146
|
back to a placeholder if the name is still missing.
|
|
147
|
+
- **`typing` arrives at most once per person per room every three seconds.** There is no
|
|
148
|
+
"stopped" event, so keep the indicator for **five seconds or more** after the last one — even
|
|
149
|
+
someone typing steadily can be broadcast more than four seconds apart, and anything shorter
|
|
150
|
+
blinks between events.
|
|
151
|
+
- **Each room announces only a few typists at a time** (three today). Every broadcast goes out
|
|
152
|
+
once per person in the room, and a screen draws "A, B and C are typing" at most anyway. In a
|
|
153
|
+
busy room some people typing are never announced — don't write code that depends on the number
|
|
154
|
+
(the engine may change it).
|
|
147
155
|
|
|
148
156
|
```ts
|
|
149
157
|
room.on('typing', ({ userId }) => {
|
|
150
158
|
if (userId === chat.user?.id) return
|
|
151
159
|
const name = room.presence?.users?.find(u => u.id === userId)?.name
|
|
152
|
-
showTyping(userId, name ?? 'Someone') // clearing it after
|
|
160
|
+
showTyping(userId, name ?? 'Someone') // clearing it after ~5 seconds is yours to do
|
|
153
161
|
})
|
|
154
162
|
```
|
|
155
163
|
- **The connection comes back on its own.** It reconnects with exponential backoff, so don't
|
|
@@ -167,6 +175,15 @@ room.on('messages', m => (messages.value = m))
|
|
|
167
175
|
like a ban, is not worth retrying.
|
|
168
176
|
- **After a nickname or avatar change, `reconnect()`.** The server reads those values from the
|
|
169
177
|
token claims once, when the socket authenticates.
|
|
178
|
+
- **Logging in or out is `reconnect()` too.** When `token()` returns a different user the SDK
|
|
179
|
+
notices: every room drops the list it held, reads recent history again as the new user and
|
|
180
|
+
emits `reset` (the rows' `myReactions` were the previous user's). A send, reaction or read still
|
|
181
|
+
waiting for the previous user is rejected with `closed` instead of going out under the new
|
|
182
|
+
name, so send as the new user after `reconnect()` resolves. `close()` then `connect()` behaves
|
|
183
|
+
the same. There is no need to create a new client. A room the new user cannot subscribe to (a
|
|
184
|
+
private room only the previous user was in) emits `error` instead of `reset` and stays empty.
|
|
185
|
+
**Call `reconnect()` whenever the login state changes** — the REST path that refreshes a token
|
|
186
|
+
on a 401 does not check whether the user changed.
|
|
170
187
|
|
|
171
188
|
### `text` is untrusted plain text
|
|
172
189
|
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ npm install @kispi/chat
|
|
|
42
42
|
|---|---|
|
|
43
43
|
| `connect()` | 붙는다. 이미 붙어 있거나 붙는 중이면 그 시도에 합류한다. 실패하면 거절하지만 **재시도는 백그라운드에서 계속된다**(아래) |
|
|
44
44
|
| `close()` | 끊는다. 이건 재접속하지 않는다. 다시 붙으려면 `connect()` |
|
|
45
|
-
| `reconnect()` | **다시 인증한다**: `token()`을 다시 불러 소켓을 바꾼다. 방 핸들과 구독, `messages`는 그대로이고 상태는 `open → reconnecting → open`이다(`closed`를 거치지 않는다). 닉네임·아바타를 바꾼
|
|
45
|
+
| `reconnect()` | **다시 인증한다**: `token()`을 다시 불러 소켓을 바꾼다. 방 핸들과 구독, `messages`는 그대로이고(**사람이 바뀌면 `messages`는 버리고 다시 채운다**) 상태는 `open → reconnecting → open`이다(`closed`를 거치지 않는다). 닉네임·아바타를 바꾼 뒤, 그리고 **로그인·로그아웃으로 사람이 바뀔 때** 쓴다(아래) |
|
|
46
46
|
| `room(roomId)` | 방 핸들. 같은 id면 같은 객체 |
|
|
47
47
|
| `roomByKey(key)` | 키로 여는 방 핸들. 구독할 때 서버가 id를 알려 준다. **방을 만들지 않는다** — 없는 키면 `subscribe()`가 `not_found`로 거절한다. 방은 백엔드가 `rooms.ensure()`로 만든다 |
|
|
48
48
|
| `rooms.list({cursor?, limit?})` | 내가 멤버인 방 + unread + 마지막 메시지 |
|
|
@@ -88,7 +88,7 @@ off()
|
|
|
88
88
|
| `reactionsOf(messageId, {emoji?, cursor?, limit?})` | 누가 눌렀는지. **한 행은 (유저, 이모지) 쌍**이라 한 사람이 여러 줄일 수 있다. `limit` 기본 50 최대 100, 마지막 페이지의 `cursor`는 빈 문자열 |
|
|
89
89
|
| `markRead(seq, {threadId?})` | 읽음 커서 |
|
|
90
90
|
| `reads({userId?, cursor?, limit?})` | 읽음 커서 목록. `{reads: [{userId?, seq, threadId?, withdrawn?}], cursor}`. **`userId`로 한 사람만** — 자기 스레드별 커서를 되찾을 때 `reads({userId: chat.user.id})`. `cursor`가 `''`이면 끝 |
|
|
91
|
-
| `typing({threadId?})` | 입력 중. 던지지 않는다. 스레드 답글을 쓰는 중이면 `threadId` |
|
|
91
|
+
| `typing({threadId?})` | 입력 중. 던지지 않는다. **입력 이벤트마다 불러도 된다** — SDK가 방마다 1초에 한 번만 보낸다. 스레드 답글을 쓰는 중이면 `threadId` |
|
|
92
92
|
| `join()` / `leave()` | 멤버십 |
|
|
93
93
|
| `presenceList()` | 지금 이 방에 있는 사람 |
|
|
94
94
|
|
|
@@ -114,7 +114,7 @@ off()
|
|
|
114
114
|
|---|---|
|
|
115
115
|
| `messages` | 목록이 바뀔 때마다. **매번 새 배열이고, 내보낸 배열은 다시 건드리지 않는다** |
|
|
116
116
|
| `error` | 히스토리를 읽거나 구멍을 메우는 데 실패했다. **방이 스스로 다시 구독한다.** 사람이 누를 재시도 버튼은 `subscribe()` |
|
|
117
|
-
| `reset` | 커서가 보존 기간보다
|
|
117
|
+
| `reset` | 목록을 버리고 다시 채웠다 — 커서가 보존 기간보다 오래됐거나, **다른 사람으로 다시 붙었다**(아래). **렌더한 것을 버려야 한다** |
|
|
118
118
|
|
|
119
119
|
### 알아 둘 것
|
|
120
120
|
|
|
@@ -141,12 +141,18 @@ room.on('messages', m => (messages.value = m))
|
|
|
141
141
|
- **`typing`은 이름을 싣지 않는다.** 이름은 `room.presence.users`에서 찾는다 — 방을 보고 있는
|
|
142
142
|
사람이 거기 있다. 메시지 발신자에서 이름을 모으면 아직 말하지 않은 사람을 모른다.
|
|
143
143
|
`users`가 없으면(100명 넘는 방) `presenceList()`로 한 번 받아 오고, 그래도 없으면 대체 이름을 쓴다.
|
|
144
|
+
- **`typing`은 한 사람당 방마다 많아야 3초에 한 번 온다.** "입력 멈춤" 이벤트는 없으니 표시는
|
|
145
|
+
마지막 이벤트 뒤 **5초 이상** 유지한다 — 계속 입력하는 사람의 방송 간격도 4초를 넘을 수 있어서,
|
|
146
|
+
그보다 짧으면 이벤트 사이에서 깜빡인다.
|
|
147
|
+
- **방마다 한 번에 알리는 사람 수에 상한이 있다**(지금 3명). 방송 한 번이 인원수만큼 나가기
|
|
148
|
+
때문이고, 화면도 "A, B, C가 입력 중" 정도까지만 그린다. 붐비는 방에서는 입력 중인데 알려지지
|
|
149
|
+
않는 사람이 있다 — 그 숫자에 기대는 코드는 짜지 않는다(엔진이 바꿀 수 있다).
|
|
144
150
|
|
|
145
151
|
```ts
|
|
146
152
|
room.on('typing', ({ userId }) => {
|
|
147
153
|
if (userId === chat.user?.id) return
|
|
148
154
|
const name = room.presence?.users?.find(u => u.id === userId)?.name
|
|
149
|
-
showTyping(userId, name ?? '누군가') //
|
|
155
|
+
showTyping(userId, name ?? '누군가') // 5초쯤 뒤 지우는 것은 소비자 몫이다
|
|
150
156
|
})
|
|
151
157
|
```
|
|
152
158
|
- **연결은 알아서 돌아온다.** 끊기면 지수 백오프로 다시 붙으니 재시도 루프를 짜지 않는다.
|
|
@@ -161,6 +167,14 @@ room.on('messages', m => (messages.value = m))
|
|
|
161
167
|
- **`token()`이 `ChatError`를 던지면 멈춘다.** 밴처럼 다시 해도 소용없는 실패를 그렇게 알린다.
|
|
162
168
|
- **닉네임·아바타를 바꿨으면 `reconnect()`.** 서버는 그 값을 접속할 때 토큰 claim에서
|
|
163
169
|
한 번 읽는다.
|
|
170
|
+
- **로그인·로그아웃도 `reconnect()`다.** `token()`이 다른 사람을 돌려주면 SDK가 알아챈다 —
|
|
171
|
+
방마다 들고 있던 목록을 버리고 새 사람의 눈으로 최근 히스토리를 다시 읽어 `reset`을 낸다
|
|
172
|
+
(행의 `myReactions`가 이전 사람의 것이었다). 이전 사람으로 기다리던 전송·리액션·읽음은 새
|
|
173
|
+
사람 이름으로 나가지 않고 `closed`로 거절되므로, 새 사람의 전송은 `reconnect()`를 기다린 뒤에 한다.
|
|
174
|
+
`close()` 뒤의 `connect()`도 같다. 클라이언트를 새로 만들 필요는 없다. 새 사람으로 다시 구독할 수
|
|
175
|
+
없는 방(이전 사람만 멤버였던 private 방)은 `reset` 대신 `error`이고 목록은 빈 채로 남는다.
|
|
176
|
+
**로그인 상태가 바뀌면 반드시 `reconnect()`를 부른다** — REST가 401에서 토큰을 갱신하는 길은
|
|
177
|
+
사람이 바뀌었는지 보지 않는다.
|
|
164
178
|
|
|
165
179
|
### `text`는 신뢰할 수 없는 평문이다
|
|
166
180
|
|
package/dist/index.cjs
CHANGED
|
@@ -613,6 +613,7 @@ function createTimeline(options) {
|
|
|
613
613
|
|
|
614
614
|
// src/room.ts
|
|
615
615
|
var HistoryPageSize = 100;
|
|
616
|
+
var TypingSendIntervalMs = 1e3;
|
|
616
617
|
var MaxRepairs = 5;
|
|
617
618
|
var RepairBaseMs = 1e3;
|
|
618
619
|
var Room = class extends Emitter {
|
|
@@ -660,6 +661,10 @@ var Room = class extends Emitter {
|
|
|
660
661
|
* silently, which is worse than the failure that started it.
|
|
661
662
|
*/
|
|
662
663
|
wanted = false;
|
|
664
|
+
/** 신원이 바뀌어 버린 목록을 다음 구독이 다시 채우고 `reset`으로 알려야 한다. */
|
|
665
|
+
rebuildPending = false;
|
|
666
|
+
/** When `typing()` last tried to send (a closed socket still spends the window). See TypingSendIntervalMs. */
|
|
667
|
+
typingSentAt = Number.NEGATIVE_INFINITY;
|
|
663
668
|
subscribing;
|
|
664
669
|
/** Self-repair: the armed retry, and how many have run since the last success. */
|
|
665
670
|
repairTimer;
|
|
@@ -770,9 +775,10 @@ var Room = class extends Emitter {
|
|
|
770
775
|
this.lastSeq = ack.lastSeq;
|
|
771
776
|
if (typeof ack.minSeq === "number") this.timeline.setFloor(ack.minSeq);
|
|
772
777
|
if (ack.presence !== void 0) this.presence = ack.presence;
|
|
773
|
-
if (attempt.wasReset) {
|
|
778
|
+
if (attempt.wasReset || this.rebuildPending) {
|
|
774
779
|
await this.loadRecent(current);
|
|
775
780
|
if (!current()) return;
|
|
781
|
+
this.rebuildPending = false;
|
|
776
782
|
this.subscribed = true;
|
|
777
783
|
this.emit("reset", this.timeline.messages);
|
|
778
784
|
return;
|
|
@@ -845,13 +851,14 @@ var Room = class extends Emitter {
|
|
|
845
851
|
*/
|
|
846
852
|
async toggleReaction(messageId, emoji, mine) {
|
|
847
853
|
const press = this.timeline.pressReaction(messageId, emoji, mine);
|
|
854
|
+
const owner = this.chat.user?.id;
|
|
848
855
|
try {
|
|
849
856
|
await this.chat.sendFrame("react", {
|
|
850
857
|
roomId: await this.resolveId("reacting"),
|
|
851
858
|
messageId,
|
|
852
859
|
emoji,
|
|
853
860
|
op: mine ? "add" : "remove"
|
|
854
|
-
}, void 0, { resendOnDrop: true });
|
|
861
|
+
}, void 0, { resendOnDrop: true, owner });
|
|
855
862
|
} catch (err) {
|
|
856
863
|
if (press !== void 0) this.timeline.settleReaction(press, false);
|
|
857
864
|
throw err;
|
|
@@ -867,9 +874,10 @@ var Room = class extends Emitter {
|
|
|
867
874
|
* way to know what happened. It is returned rather than swallowed.
|
|
868
875
|
*/
|
|
869
876
|
async markRead(seq, options = {}) {
|
|
877
|
+
const owner = this.chat.user?.id;
|
|
870
878
|
const data = { roomId: await this.resolveId("marking read"), seq };
|
|
871
879
|
if (options.threadId !== void 0) data["threadId"] = options.threadId;
|
|
872
|
-
return await this.chat.sendFrame("read", data, void 0, { resendOnDrop: true });
|
|
880
|
+
return await this.chat.sendFrame("read", data, void 0, { resendOnDrop: true, owner });
|
|
873
881
|
}
|
|
874
882
|
/**
|
|
875
883
|
* Lists read cursors in this room, one page at a time.
|
|
@@ -917,11 +925,26 @@ var Room = class extends Emitter {
|
|
|
917
925
|
* and the main view can skip them. The server keeps one throttle slot
|
|
918
926
|
* per user per room, not per thread: switching between the main box
|
|
919
927
|
* and a thread is heard up to three seconds late.
|
|
928
|
+
*
|
|
929
|
+
* **Call it on every input event; the SDK throttles.** At most one frame
|
|
930
|
+
* leaves per room per second, and the server
|
|
931
|
+
* broadcasts at most one per three seconds. There is no "stopped"
|
|
932
|
+
* event, so show the indicator for five seconds or more after
|
|
933
|
+
* the last one: the gap between one person's broadcasts is three
|
|
934
|
+
* seconds plus this throttle plus the wait for their next keystroke,
|
|
935
|
+
* and longer in a busy room. Anything shorter blinks between signals.
|
|
936
|
+
*
|
|
937
|
+
* The server also caps how many people one room announces per window
|
|
938
|
+
* (a screen draws "A, B and C are typing" at most), so in a busy room
|
|
939
|
+
* some typists are never announced.
|
|
920
940
|
*/
|
|
921
941
|
typing(options = {}) {
|
|
942
|
+
const now = Date.now();
|
|
943
|
+
if (now >= this.typingSentAt && now - this.typingSentAt < TypingSendIntervalMs) return;
|
|
922
944
|
try {
|
|
923
945
|
const data = { roomId: this.requireId("typing") };
|
|
924
946
|
if (options.threadId !== void 0) data["threadId"] = options.threadId;
|
|
947
|
+
this.typingSentAt = now;
|
|
925
948
|
void this.chat.sendFrame("typing", data, void 0, { wait: false }).catch(() => {
|
|
926
949
|
});
|
|
927
950
|
} catch {
|
|
@@ -965,7 +988,11 @@ var Room = class extends Emitter {
|
|
|
965
988
|
* transient 500 takes a room out of the live feed for the life of the
|
|
966
989
|
* page.
|
|
967
990
|
*/
|
|
968
|
-
async resume(restart = true) {
|
|
991
|
+
async resume(restart = true, userChanged = false) {
|
|
992
|
+
if (userChanged) {
|
|
993
|
+
this.timeline.discard();
|
|
994
|
+
if (this.wanted) this.rebuildPending = true;
|
|
995
|
+
}
|
|
969
996
|
if (!this.wanted) return;
|
|
970
997
|
if (!restart) return this.subscribe();
|
|
971
998
|
this.generation++;
|
|
@@ -1018,6 +1045,7 @@ var Room = class extends Emitter {
|
|
|
1018
1045
|
if (this.id === void 0) return;
|
|
1019
1046
|
this.wanted = false;
|
|
1020
1047
|
this.subscribed = false;
|
|
1048
|
+
this.rebuildPending = false;
|
|
1021
1049
|
this.generation++;
|
|
1022
1050
|
this.subscribing = void 0;
|
|
1023
1051
|
await this.chat.sendFrame("unsubscribe", { roomId: this.id }, void 0, { wait: false });
|
|
@@ -1052,6 +1080,7 @@ var Room = class extends Emitter {
|
|
|
1052
1080
|
}
|
|
1053
1081
|
/** Publishes and resolves when the server acks. */
|
|
1054
1082
|
async send(input, options = {}) {
|
|
1083
|
+
const owner = this.chat.user?.id;
|
|
1055
1084
|
const roomId = await this.resolveId("sending");
|
|
1056
1085
|
const body = {};
|
|
1057
1086
|
if (input.text !== void 0) body["text"] = input.text;
|
|
@@ -1065,7 +1094,7 @@ var Room = class extends Emitter {
|
|
|
1065
1094
|
if (input.replyTo !== void 0) frame["replyTo"] = input.replyTo;
|
|
1066
1095
|
if (input.threadId !== void 0) frame["threadId"] = input.threadId;
|
|
1067
1096
|
if (input.meta !== void 0) frame["meta"] = input.meta;
|
|
1068
|
-
return await this.chat.sendFrame("publish", frame, void 0, { resendOnDrop: true });
|
|
1097
|
+
return await this.chat.sendFrame("publish", frame, void 0, { resendOnDrop: true, owner });
|
|
1069
1098
|
}
|
|
1070
1099
|
/** @internal Routes a frame the client decided belongs to this room. */
|
|
1071
1100
|
handle(type, data) {
|
|
@@ -1375,13 +1404,21 @@ var ChatClient = class extends Emitter {
|
|
|
1375
1404
|
* does that too, but passes through `closed` (a consumer's "you are
|
|
1376
1405
|
* offline" screen) and tears down the page listeners.
|
|
1377
1406
|
*
|
|
1378
|
-
* States: `open` → `reconnecting` → `open`, never `closed`.
|
|
1379
|
-
* resubscribe from what they hold and catch up the gap, as
|
|
1380
|
-
* drop; `messages` is kept. Frames awaiting an ack on the old
|
|
1381
|
-
* rejected with `closed`. `chat.user` is the new identity
|
|
1382
|
-
* resolves. If `token()` fails the client keeps retrying in
|
|
1383
|
-
* background like any reconnect (and this rejects); a `ChatError`
|
|
1384
|
-
* `token()` stops it at `closed`, as on connect.
|
|
1407
|
+
* States: `open` → `reconnecting` → `open`, never `closed`. For the same
|
|
1408
|
+
* user, rooms resubscribe from what they hold and catch up the gap, as
|
|
1409
|
+
* after any drop; `messages` is kept. Frames awaiting an ack on the old
|
|
1410
|
+
* socket are rejected with `closed`. `chat.user` is the new identity
|
|
1411
|
+
* once this resolves. If `token()` fails the client keeps retrying in
|
|
1412
|
+
* the background like any reconnect (and this rejects); a `ChatError`
|
|
1413
|
+
* from `token()` stops it at `closed`, as on connect.
|
|
1414
|
+
*
|
|
1415
|
+
* **Logging in or out is this too.** When the new token names a
|
|
1416
|
+
* different user, every room drops what it held, reloads recent
|
|
1417
|
+
* history for the new user, and emits `reset` -- the rows carried the
|
|
1418
|
+
* old user's `myReactions`. A frame the old user started and that is
|
|
1419
|
+
* still waiting (a send pressed while reconnecting, a resend after a
|
|
1420
|
+
* drop) is rejected with `closed` instead of going out under the new
|
|
1421
|
+
* name, so send as the new user after this resolves.
|
|
1385
1422
|
*
|
|
1386
1423
|
* On a client that is not connected (never connected, or `close()`d) it
|
|
1387
1424
|
* is `connect()`.
|
|
@@ -1493,6 +1530,7 @@ var ChatClient = class extends Emitter {
|
|
|
1493
1530
|
sendFrame(type, data, timeoutMs = 15e3, options = {}) {
|
|
1494
1531
|
const deadline = Date.now() + timeoutMs;
|
|
1495
1532
|
const wait = options.wait ?? true;
|
|
1533
|
+
const owner = options.owner ?? this.user?.id;
|
|
1496
1534
|
const run = async (resends) => {
|
|
1497
1535
|
if (this.socket === void 0 || this.state !== "open") {
|
|
1498
1536
|
if (!wait || this.stopped || this.state === "closed") {
|
|
@@ -1505,6 +1543,9 @@ var ChatClient = class extends Emitter {
|
|
|
1505
1543
|
}
|
|
1506
1544
|
await this.untilOpen(type, deadline);
|
|
1507
1545
|
}
|
|
1546
|
+
if (owner !== void 0 && this.user?.id !== owner) {
|
|
1547
|
+
throw new ChatError("closed", `cannot send ${type}: the user changed while it was waiting`);
|
|
1548
|
+
}
|
|
1508
1549
|
try {
|
|
1509
1550
|
return await this.sendOnSocket(type, data, Math.max(0, deadline - Date.now()));
|
|
1510
1551
|
} catch (err) {
|
|
@@ -1646,6 +1687,7 @@ var ChatClient = class extends Emitter {
|
|
|
1646
1687
|
});
|
|
1647
1688
|
}
|
|
1648
1689
|
onHello(hello) {
|
|
1690
|
+
const userChanged = this.user !== void 0 && this.user.id !== hello.user.id;
|
|
1649
1691
|
this.hello = hello;
|
|
1650
1692
|
this.user = hello.user;
|
|
1651
1693
|
this.connectionId = hello.connectionId;
|
|
@@ -1656,7 +1698,7 @@ var ChatClient = class extends Emitter {
|
|
|
1656
1698
|
this.setState("open");
|
|
1657
1699
|
this.settleOpenWaiters();
|
|
1658
1700
|
for (const room of this.handles.values()) {
|
|
1659
|
-
void room.resume(reconnected).catch((err) => {
|
|
1701
|
+
void room.resume(reconnected, userChanged).catch((err) => {
|
|
1660
1702
|
room.failed(err);
|
|
1661
1703
|
});
|
|
1662
1704
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -280,8 +280,10 @@ type RoomEvents = {
|
|
|
280
280
|
*/
|
|
281
281
|
error: Error;
|
|
282
282
|
/**
|
|
283
|
-
* The timeline was thrown away and rebuilt
|
|
284
|
-
*
|
|
283
|
+
* The timeline was thrown away and rebuilt: the server said this
|
|
284
|
+
* client's cursor was older than the room's retention, or the client
|
|
285
|
+
* reconnected as **a different user** (`myReactions` on the rows it held
|
|
286
|
+
* was the previous user's).
|
|
285
287
|
*
|
|
286
288
|
* A consumer holding rendered messages has to drop them: the list is
|
|
287
289
|
* new, and quietly appending to the old one leaves a gap that no fill
|
|
@@ -397,6 +399,10 @@ declare class Room extends Emitter<RoomEvents> {
|
|
|
397
399
|
* silently, which is worse than the failure that started it.
|
|
398
400
|
*/
|
|
399
401
|
private wanted;
|
|
402
|
+
/** 신원이 바뀌어 버린 목록을 다음 구독이 다시 채우고 `reset`으로 알려야 한다. */
|
|
403
|
+
private rebuildPending;
|
|
404
|
+
/** When `typing()` last tried to send (a closed socket still spends the window). See TypingSendIntervalMs. */
|
|
405
|
+
private typingSentAt;
|
|
400
406
|
private subscribing;
|
|
401
407
|
/** Self-repair: the armed retry, and how many have run since the last success. */
|
|
402
408
|
private repairTimer;
|
|
@@ -574,6 +580,18 @@ declare class Room extends Emitter<RoomEvents> {
|
|
|
574
580
|
* and the main view can skip them. The server keeps one throttle slot
|
|
575
581
|
* per user per room, not per thread: switching between the main box
|
|
576
582
|
* and a thread is heard up to three seconds late.
|
|
583
|
+
*
|
|
584
|
+
* **Call it on every input event; the SDK throttles.** At most one frame
|
|
585
|
+
* leaves per room per second, and the server
|
|
586
|
+
* broadcasts at most one per three seconds. There is no "stopped"
|
|
587
|
+
* event, so show the indicator for five seconds or more after
|
|
588
|
+
* the last one: the gap between one person's broadcasts is three
|
|
589
|
+
* seconds plus this throttle plus the wait for their next keystroke,
|
|
590
|
+
* and longer in a busy room. Anything shorter blinks between signals.
|
|
591
|
+
*
|
|
592
|
+
* The server also caps how many people one room announces per window
|
|
593
|
+
* (a screen draws "A, B and C are typing" at most), so in a busy room
|
|
594
|
+
* some typists are never announced.
|
|
577
595
|
*/
|
|
578
596
|
typing(options?: {
|
|
579
597
|
threadId?: string;
|
|
@@ -844,13 +862,21 @@ declare class ChatClient extends Emitter<ChatClientEvents> {
|
|
|
844
862
|
* does that too, but passes through `closed` (a consumer's "you are
|
|
845
863
|
* offline" screen) and tears down the page listeners.
|
|
846
864
|
*
|
|
847
|
-
* States: `open` → `reconnecting` → `open`, never `closed`.
|
|
848
|
-
* resubscribe from what they hold and catch up the gap, as
|
|
849
|
-
* drop; `messages` is kept. Frames awaiting an ack on the old
|
|
850
|
-
* rejected with `closed`. `chat.user` is the new identity
|
|
851
|
-
* resolves. If `token()` fails the client keeps retrying in
|
|
852
|
-
* background like any reconnect (and this rejects); a `ChatError`
|
|
853
|
-
* `token()` stops it at `closed`, as on connect.
|
|
865
|
+
* States: `open` → `reconnecting` → `open`, never `closed`. For the same
|
|
866
|
+
* user, rooms resubscribe from what they hold and catch up the gap, as
|
|
867
|
+
* after any drop; `messages` is kept. Frames awaiting an ack on the old
|
|
868
|
+
* socket are rejected with `closed`. `chat.user` is the new identity
|
|
869
|
+
* once this resolves. If `token()` fails the client keeps retrying in
|
|
870
|
+
* the background like any reconnect (and this rejects); a `ChatError`
|
|
871
|
+
* from `token()` stops it at `closed`, as on connect.
|
|
872
|
+
*
|
|
873
|
+
* **Logging in or out is this too.** When the new token names a
|
|
874
|
+
* different user, every room drops what it held, reloads recent
|
|
875
|
+
* history for the new user, and emits `reset` -- the rows carried the
|
|
876
|
+
* old user's `myReactions`. A frame the old user started and that is
|
|
877
|
+
* still waiting (a send pressed while reconnecting, a resend after a
|
|
878
|
+
* drop) is rejected with `closed` instead of going out under the new
|
|
879
|
+
* name, so send as the new user after this resolves.
|
|
854
880
|
*
|
|
855
881
|
* On a client that is not connected (never connected, or `close()`d) it
|
|
856
882
|
* is `connect()`.
|
package/dist/index.d.ts
CHANGED
|
@@ -280,8 +280,10 @@ type RoomEvents = {
|
|
|
280
280
|
*/
|
|
281
281
|
error: Error;
|
|
282
282
|
/**
|
|
283
|
-
* The timeline was thrown away and rebuilt
|
|
284
|
-
*
|
|
283
|
+
* The timeline was thrown away and rebuilt: the server said this
|
|
284
|
+
* client's cursor was older than the room's retention, or the client
|
|
285
|
+
* reconnected as **a different user** (`myReactions` on the rows it held
|
|
286
|
+
* was the previous user's).
|
|
285
287
|
*
|
|
286
288
|
* A consumer holding rendered messages has to drop them: the list is
|
|
287
289
|
* new, and quietly appending to the old one leaves a gap that no fill
|
|
@@ -397,6 +399,10 @@ declare class Room extends Emitter<RoomEvents> {
|
|
|
397
399
|
* silently, which is worse than the failure that started it.
|
|
398
400
|
*/
|
|
399
401
|
private wanted;
|
|
402
|
+
/** 신원이 바뀌어 버린 목록을 다음 구독이 다시 채우고 `reset`으로 알려야 한다. */
|
|
403
|
+
private rebuildPending;
|
|
404
|
+
/** When `typing()` last tried to send (a closed socket still spends the window). See TypingSendIntervalMs. */
|
|
405
|
+
private typingSentAt;
|
|
400
406
|
private subscribing;
|
|
401
407
|
/** Self-repair: the armed retry, and how many have run since the last success. */
|
|
402
408
|
private repairTimer;
|
|
@@ -574,6 +580,18 @@ declare class Room extends Emitter<RoomEvents> {
|
|
|
574
580
|
* and the main view can skip them. The server keeps one throttle slot
|
|
575
581
|
* per user per room, not per thread: switching between the main box
|
|
576
582
|
* and a thread is heard up to three seconds late.
|
|
583
|
+
*
|
|
584
|
+
* **Call it on every input event; the SDK throttles.** At most one frame
|
|
585
|
+
* leaves per room per second, and the server
|
|
586
|
+
* broadcasts at most one per three seconds. There is no "stopped"
|
|
587
|
+
* event, so show the indicator for five seconds or more after
|
|
588
|
+
* the last one: the gap between one person's broadcasts is three
|
|
589
|
+
* seconds plus this throttle plus the wait for their next keystroke,
|
|
590
|
+
* and longer in a busy room. Anything shorter blinks between signals.
|
|
591
|
+
*
|
|
592
|
+
* The server also caps how many people one room announces per window
|
|
593
|
+
* (a screen draws "A, B and C are typing" at most), so in a busy room
|
|
594
|
+
* some typists are never announced.
|
|
577
595
|
*/
|
|
578
596
|
typing(options?: {
|
|
579
597
|
threadId?: string;
|
|
@@ -844,13 +862,21 @@ declare class ChatClient extends Emitter<ChatClientEvents> {
|
|
|
844
862
|
* does that too, but passes through `closed` (a consumer's "you are
|
|
845
863
|
* offline" screen) and tears down the page listeners.
|
|
846
864
|
*
|
|
847
|
-
* States: `open` → `reconnecting` → `open`, never `closed`.
|
|
848
|
-
* resubscribe from what they hold and catch up the gap, as
|
|
849
|
-
* drop; `messages` is kept. Frames awaiting an ack on the old
|
|
850
|
-
* rejected with `closed`. `chat.user` is the new identity
|
|
851
|
-
* resolves. If `token()` fails the client keeps retrying in
|
|
852
|
-
* background like any reconnect (and this rejects); a `ChatError`
|
|
853
|
-
* `token()` stops it at `closed`, as on connect.
|
|
865
|
+
* States: `open` → `reconnecting` → `open`, never `closed`. For the same
|
|
866
|
+
* user, rooms resubscribe from what they hold and catch up the gap, as
|
|
867
|
+
* after any drop; `messages` is kept. Frames awaiting an ack on the old
|
|
868
|
+
* socket are rejected with `closed`. `chat.user` is the new identity
|
|
869
|
+
* once this resolves. If `token()` fails the client keeps retrying in
|
|
870
|
+
* the background like any reconnect (and this rejects); a `ChatError`
|
|
871
|
+
* from `token()` stops it at `closed`, as on connect.
|
|
872
|
+
*
|
|
873
|
+
* **Logging in or out is this too.** When the new token names a
|
|
874
|
+
* different user, every room drops what it held, reloads recent
|
|
875
|
+
* history for the new user, and emits `reset` -- the rows carried the
|
|
876
|
+
* old user's `myReactions`. A frame the old user started and that is
|
|
877
|
+
* still waiting (a send pressed while reconnecting, a resend after a
|
|
878
|
+
* drop) is rejected with `closed` instead of going out under the new
|
|
879
|
+
* name, so send as the new user after this resolves.
|
|
854
880
|
*
|
|
855
881
|
* On a client that is not connected (never connected, or `close()`d) it
|
|
856
882
|
* is `connect()`.
|
package/dist/index.js
CHANGED
|
@@ -543,6 +543,7 @@ function createTimeline(options) {
|
|
|
543
543
|
|
|
544
544
|
// src/room.ts
|
|
545
545
|
var HistoryPageSize = 100;
|
|
546
|
+
var TypingSendIntervalMs = 1e3;
|
|
546
547
|
var MaxRepairs = 5;
|
|
547
548
|
var RepairBaseMs = 1e3;
|
|
548
549
|
var Room = class extends Emitter {
|
|
@@ -590,6 +591,10 @@ var Room = class extends Emitter {
|
|
|
590
591
|
* silently, which is worse than the failure that started it.
|
|
591
592
|
*/
|
|
592
593
|
wanted = false;
|
|
594
|
+
/** 신원이 바뀌어 버린 목록을 다음 구독이 다시 채우고 `reset`으로 알려야 한다. */
|
|
595
|
+
rebuildPending = false;
|
|
596
|
+
/** When `typing()` last tried to send (a closed socket still spends the window). See TypingSendIntervalMs. */
|
|
597
|
+
typingSentAt = Number.NEGATIVE_INFINITY;
|
|
593
598
|
subscribing;
|
|
594
599
|
/** Self-repair: the armed retry, and how many have run since the last success. */
|
|
595
600
|
repairTimer;
|
|
@@ -700,9 +705,10 @@ var Room = class extends Emitter {
|
|
|
700
705
|
this.lastSeq = ack.lastSeq;
|
|
701
706
|
if (typeof ack.minSeq === "number") this.timeline.setFloor(ack.minSeq);
|
|
702
707
|
if (ack.presence !== void 0) this.presence = ack.presence;
|
|
703
|
-
if (attempt.wasReset) {
|
|
708
|
+
if (attempt.wasReset || this.rebuildPending) {
|
|
704
709
|
await this.loadRecent(current);
|
|
705
710
|
if (!current()) return;
|
|
711
|
+
this.rebuildPending = false;
|
|
706
712
|
this.subscribed = true;
|
|
707
713
|
this.emit("reset", this.timeline.messages);
|
|
708
714
|
return;
|
|
@@ -775,13 +781,14 @@ var Room = class extends Emitter {
|
|
|
775
781
|
*/
|
|
776
782
|
async toggleReaction(messageId, emoji, mine) {
|
|
777
783
|
const press = this.timeline.pressReaction(messageId, emoji, mine);
|
|
784
|
+
const owner = this.chat.user?.id;
|
|
778
785
|
try {
|
|
779
786
|
await this.chat.sendFrame("react", {
|
|
780
787
|
roomId: await this.resolveId("reacting"),
|
|
781
788
|
messageId,
|
|
782
789
|
emoji,
|
|
783
790
|
op: mine ? "add" : "remove"
|
|
784
|
-
}, void 0, { resendOnDrop: true });
|
|
791
|
+
}, void 0, { resendOnDrop: true, owner });
|
|
785
792
|
} catch (err) {
|
|
786
793
|
if (press !== void 0) this.timeline.settleReaction(press, false);
|
|
787
794
|
throw err;
|
|
@@ -797,9 +804,10 @@ var Room = class extends Emitter {
|
|
|
797
804
|
* way to know what happened. It is returned rather than swallowed.
|
|
798
805
|
*/
|
|
799
806
|
async markRead(seq, options = {}) {
|
|
807
|
+
const owner = this.chat.user?.id;
|
|
800
808
|
const data = { roomId: await this.resolveId("marking read"), seq };
|
|
801
809
|
if (options.threadId !== void 0) data["threadId"] = options.threadId;
|
|
802
|
-
return await this.chat.sendFrame("read", data, void 0, { resendOnDrop: true });
|
|
810
|
+
return await this.chat.sendFrame("read", data, void 0, { resendOnDrop: true, owner });
|
|
803
811
|
}
|
|
804
812
|
/**
|
|
805
813
|
* Lists read cursors in this room, one page at a time.
|
|
@@ -847,11 +855,26 @@ var Room = class extends Emitter {
|
|
|
847
855
|
* and the main view can skip them. The server keeps one throttle slot
|
|
848
856
|
* per user per room, not per thread: switching between the main box
|
|
849
857
|
* and a thread is heard up to three seconds late.
|
|
858
|
+
*
|
|
859
|
+
* **Call it on every input event; the SDK throttles.** At most one frame
|
|
860
|
+
* leaves per room per second, and the server
|
|
861
|
+
* broadcasts at most one per three seconds. There is no "stopped"
|
|
862
|
+
* event, so show the indicator for five seconds or more after
|
|
863
|
+
* the last one: the gap between one person's broadcasts is three
|
|
864
|
+
* seconds plus this throttle plus the wait for their next keystroke,
|
|
865
|
+
* and longer in a busy room. Anything shorter blinks between signals.
|
|
866
|
+
*
|
|
867
|
+
* The server also caps how many people one room announces per window
|
|
868
|
+
* (a screen draws "A, B and C are typing" at most), so in a busy room
|
|
869
|
+
* some typists are never announced.
|
|
850
870
|
*/
|
|
851
871
|
typing(options = {}) {
|
|
872
|
+
const now = Date.now();
|
|
873
|
+
if (now >= this.typingSentAt && now - this.typingSentAt < TypingSendIntervalMs) return;
|
|
852
874
|
try {
|
|
853
875
|
const data = { roomId: this.requireId("typing") };
|
|
854
876
|
if (options.threadId !== void 0) data["threadId"] = options.threadId;
|
|
877
|
+
this.typingSentAt = now;
|
|
855
878
|
void this.chat.sendFrame("typing", data, void 0, { wait: false }).catch(() => {
|
|
856
879
|
});
|
|
857
880
|
} catch {
|
|
@@ -895,7 +918,11 @@ var Room = class extends Emitter {
|
|
|
895
918
|
* transient 500 takes a room out of the live feed for the life of the
|
|
896
919
|
* page.
|
|
897
920
|
*/
|
|
898
|
-
async resume(restart = true) {
|
|
921
|
+
async resume(restart = true, userChanged = false) {
|
|
922
|
+
if (userChanged) {
|
|
923
|
+
this.timeline.discard();
|
|
924
|
+
if (this.wanted) this.rebuildPending = true;
|
|
925
|
+
}
|
|
899
926
|
if (!this.wanted) return;
|
|
900
927
|
if (!restart) return this.subscribe();
|
|
901
928
|
this.generation++;
|
|
@@ -948,6 +975,7 @@ var Room = class extends Emitter {
|
|
|
948
975
|
if (this.id === void 0) return;
|
|
949
976
|
this.wanted = false;
|
|
950
977
|
this.subscribed = false;
|
|
978
|
+
this.rebuildPending = false;
|
|
951
979
|
this.generation++;
|
|
952
980
|
this.subscribing = void 0;
|
|
953
981
|
await this.chat.sendFrame("unsubscribe", { roomId: this.id }, void 0, { wait: false });
|
|
@@ -982,6 +1010,7 @@ var Room = class extends Emitter {
|
|
|
982
1010
|
}
|
|
983
1011
|
/** Publishes and resolves when the server acks. */
|
|
984
1012
|
async send(input, options = {}) {
|
|
1013
|
+
const owner = this.chat.user?.id;
|
|
985
1014
|
const roomId = await this.resolveId("sending");
|
|
986
1015
|
const body = {};
|
|
987
1016
|
if (input.text !== void 0) body["text"] = input.text;
|
|
@@ -995,7 +1024,7 @@ var Room = class extends Emitter {
|
|
|
995
1024
|
if (input.replyTo !== void 0) frame["replyTo"] = input.replyTo;
|
|
996
1025
|
if (input.threadId !== void 0) frame["threadId"] = input.threadId;
|
|
997
1026
|
if (input.meta !== void 0) frame["meta"] = input.meta;
|
|
998
|
-
return await this.chat.sendFrame("publish", frame, void 0, { resendOnDrop: true });
|
|
1027
|
+
return await this.chat.sendFrame("publish", frame, void 0, { resendOnDrop: true, owner });
|
|
999
1028
|
}
|
|
1000
1029
|
/** @internal Routes a frame the client decided belongs to this room. */
|
|
1001
1030
|
handle(type, data) {
|
|
@@ -1305,13 +1334,21 @@ var ChatClient = class extends Emitter {
|
|
|
1305
1334
|
* does that too, but passes through `closed` (a consumer's "you are
|
|
1306
1335
|
* offline" screen) and tears down the page listeners.
|
|
1307
1336
|
*
|
|
1308
|
-
* States: `open` → `reconnecting` → `open`, never `closed`.
|
|
1309
|
-
* resubscribe from what they hold and catch up the gap, as
|
|
1310
|
-
* drop; `messages` is kept. Frames awaiting an ack on the old
|
|
1311
|
-
* rejected with `closed`. `chat.user` is the new identity
|
|
1312
|
-
* resolves. If `token()` fails the client keeps retrying in
|
|
1313
|
-
* background like any reconnect (and this rejects); a `ChatError`
|
|
1314
|
-
* `token()` stops it at `closed`, as on connect.
|
|
1337
|
+
* States: `open` → `reconnecting` → `open`, never `closed`. For the same
|
|
1338
|
+
* user, rooms resubscribe from what they hold and catch up the gap, as
|
|
1339
|
+
* after any drop; `messages` is kept. Frames awaiting an ack on the old
|
|
1340
|
+
* socket are rejected with `closed`. `chat.user` is the new identity
|
|
1341
|
+
* once this resolves. If `token()` fails the client keeps retrying in
|
|
1342
|
+
* the background like any reconnect (and this rejects); a `ChatError`
|
|
1343
|
+
* from `token()` stops it at `closed`, as on connect.
|
|
1344
|
+
*
|
|
1345
|
+
* **Logging in or out is this too.** When the new token names a
|
|
1346
|
+
* different user, every room drops what it held, reloads recent
|
|
1347
|
+
* history for the new user, and emits `reset` -- the rows carried the
|
|
1348
|
+
* old user's `myReactions`. A frame the old user started and that is
|
|
1349
|
+
* still waiting (a send pressed while reconnecting, a resend after a
|
|
1350
|
+
* drop) is rejected with `closed` instead of going out under the new
|
|
1351
|
+
* name, so send as the new user after this resolves.
|
|
1315
1352
|
*
|
|
1316
1353
|
* On a client that is not connected (never connected, or `close()`d) it
|
|
1317
1354
|
* is `connect()`.
|
|
@@ -1423,6 +1460,7 @@ var ChatClient = class extends Emitter {
|
|
|
1423
1460
|
sendFrame(type, data, timeoutMs = 15e3, options = {}) {
|
|
1424
1461
|
const deadline = Date.now() + timeoutMs;
|
|
1425
1462
|
const wait = options.wait ?? true;
|
|
1463
|
+
const owner = options.owner ?? this.user?.id;
|
|
1426
1464
|
const run = async (resends) => {
|
|
1427
1465
|
if (this.socket === void 0 || this.state !== "open") {
|
|
1428
1466
|
if (!wait || this.stopped || this.state === "closed") {
|
|
@@ -1435,6 +1473,9 @@ var ChatClient = class extends Emitter {
|
|
|
1435
1473
|
}
|
|
1436
1474
|
await this.untilOpen(type, deadline);
|
|
1437
1475
|
}
|
|
1476
|
+
if (owner !== void 0 && this.user?.id !== owner) {
|
|
1477
|
+
throw new ChatError("closed", `cannot send ${type}: the user changed while it was waiting`);
|
|
1478
|
+
}
|
|
1438
1479
|
try {
|
|
1439
1480
|
return await this.sendOnSocket(type, data, Math.max(0, deadline - Date.now()));
|
|
1440
1481
|
} catch (err) {
|
|
@@ -1576,6 +1617,7 @@ var ChatClient = class extends Emitter {
|
|
|
1576
1617
|
});
|
|
1577
1618
|
}
|
|
1578
1619
|
onHello(hello) {
|
|
1620
|
+
const userChanged = this.user !== void 0 && this.user.id !== hello.user.id;
|
|
1579
1621
|
this.hello = hello;
|
|
1580
1622
|
this.user = hello.user;
|
|
1581
1623
|
this.connectionId = hello.connectionId;
|
|
@@ -1586,7 +1628,7 @@ var ChatClient = class extends Emitter {
|
|
|
1586
1628
|
this.setState("open");
|
|
1587
1629
|
this.settleOpenWaiters();
|
|
1588
1630
|
for (const room of this.handles.values()) {
|
|
1589
|
-
void room.resume(reconnected).catch((err) => {
|
|
1631
|
+
void room.resume(reconnected, userChanged).catch((err) => {
|
|
1590
1632
|
room.failed(err);
|
|
1591
1633
|
});
|
|
1592
1634
|
}
|