Skip to content

Commit

Permalink
chore: update socket hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Oct 31, 2024
1 parent 8c55e60 commit c70555e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/hook/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const useWebSocket = (url: string, room: string) => {

const connectWebSocket = () => {
socketRef.current = new WebSocket(url);
console.log(socketRef.current);
if (socketRef.current.readyState !== WebSocket.OPEN) {
setIsConnected(false);
}

socketRef.current.onopen = () => {
setIsConnected(true);
Expand Down

0 comments on commit c70555e

Please sign in to comment.