Skip to content

Commit

Permalink
chore: update ping
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Nov 2, 2024
1 parent 363b14d commit bb00780
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions modules/hook/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ const useWebSocket = (url: string, room: string, user: string) => {
const countRef = useRef<number>(0);

function ping() {
console.log(socketRef.current);
const i = setInterval(() => {
if (countRef.current > 0) {
clearInterval(i);
setIsConnected(true);
return;
return clearInterval(i);
}
socketRef.current?.send(
JSON.stringify({ type: "ping", room, user }),
Expand Down

0 comments on commit bb00780

Please sign in to comment.