Skip to content

Commit

Permalink
Fix data handling in WebSocket message event
Browse files Browse the repository at this point in the history
  • Loading branch information
tako0614 committed Jun 16, 2024
1 parent 0bfbe43 commit 42f8365
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routes/api/v1/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export const handler = {
const { socket, response } = Deno.upgradeWebSocket(req)
socket.onmessage = async function (event) {
const data = JSON.parse(event.data)
const { type } = data
if(!data) return
const type = data.type
if(!type) return
switch (type) {
case "joinRoom":
Expand Down

0 comments on commit 42f8365

Please sign in to comment.