diff --git a/shared/api/socket.ts b/shared/api/socket.ts index 34bb3460..a1fd8f4e 100644 --- a/shared/api/socket.ts +++ b/shared/api/socket.ts @@ -87,7 +87,9 @@ export function createSocket(token: string): Promise { }); socket.once('connect', () => { // 连接成功 - resolve(new AppSocket(socket)); + const appSocket = new AppSocket(socket); + appSocket.request('chat.converse.findAndJoinRoom'); // 立即请求加入房间 + resolve(appSocket); }); socket.once('error', () => { reject(); diff --git a/shared/redux/hooks/useConverseMessage.ts b/shared/redux/hooks/useConverseMessage.ts index 10a825e3..306d8219 100644 --- a/shared/redux/hooks/useConverseMessage.ts +++ b/shared/redux/hooks/useConverseMessage.ts @@ -55,7 +55,7 @@ export function useConverseMessage(context: ConverseContext) { }) ); } else { - // 已存在 + // 已存在会话 if (!converse.hasFetchedHistory) { // 没有获取过历史消息 // 拉取历史消息