Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/components/commons/chat/Chatting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
const token = localStorage.getItem('access_token')
if (!token) return

const wsUrl = `ws://api.ozcoding.site/ws/chat/${selectedChatRoom.uuid}/?token=${token}`
const wsUrl = `wss://api.ozcoding.site/ws/chat/${selectedChatRoom.uuid}/?token=${token}`
const ws = new WebSocket(wsUrl)

ws.onopen = () => {
Expand Down Expand Up @@ -137,6 +137,31 @@
}, [selectedChatRoom, user])

const sendMessage = (content: string) => {
console.log('🔵 sendMessage 호출됨')

Check warning on line 140 in src/components/commons/chat/Chatting.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
console.log('content:', content)

Check warning on line 141 in src/components/commons/chat/Chatting.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
console.log('socketRef.current:', socketRef.current)

Check warning on line 142 in src/components/commons/chat/Chatting.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
console.log('readyState:', socketRef.current?.readyState)

Check warning on line 143 in src/components/commons/chat/Chatting.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
console.log('WebSocket.OPEN:', WebSocket.OPEN)

Check warning on line 144 in src/components/commons/chat/Chatting.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
console.log('selectedChatRoom?.uuid:', selectedChatRoom?.uuid)

if (
!socketRef.current ||
socketRef.current.readyState !== WebSocket.OPEN ||
!content.trim() ||
!selectedChatRoom?.uuid
) {
console.log('❌ 조건 실패')
console.log('socketRef 있음?', !!socketRef.current)
console.log(
'OPEN 상태?',
socketRef.current?.readyState === WebSocket.OPEN
)
console.log('content 있음?', !!content.trim())
console.log('uuid 있음?', !!selectedChatRoom?.uuid)
return false
}

console.log('✅ 메시지 전송 시도')
if (
!socketRef.current ||
socketRef.current.readyState !== WebSocket.OPEN ||
Expand Down
4 changes: 2 additions & 2 deletions src/mock/browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/mock/browser.ts
import { setupWorker } from 'msw/browser'
import { handlers } from './handlers'
import { websocketHandlers } from './websocketHandlers'
// import { websocketHandlers } from './websocketHandlers'

export const worker = setupWorker(...handlers, ...websocketHandlers)
export const worker = setupWorker(...handlers)
Loading