diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index c3a52ff..082b928 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -166,7 +166,6 @@ const Meeting: React.FC = () => { getRoomUser() break; } - }) }, []) diff --git a/src/utils/package/signalr.ts b/src/utils/package/signalr.ts index f9d3591..2c5aed6 100644 --- a/src/utils/package/signalr.ts +++ b/src/utils/package/signalr.ts @@ -17,18 +17,19 @@ export const startSignalr = () => { } export const onSignalr = (callBack: Function) => { - connection.on("ReceiveMessage", (uid: string, userName: string, message: string) => { - callBack({ - key:'ReceiveMessage', - uid, message, userName - }) - }); - connection.on("RefreshUserList", () => { - callBack({ - key: 'ReceiveMessage' - }) - }); - + if (connection){ + connection.on("ReceiveMessage", (uid: string, userName: string, message: string) => { + callBack({ + key:'ReceiveMessage', + uid, message, userName + }) + }); + connection.on("RefreshUserList", () => { + callBack({ + key: 'ReceiveMessage' + }) + }); + } } export const onInvoke = async (str: string, data: any) => { switch (str) {