Skip to content

Commit

Permalink
chore: websocket log
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Apr 19, 2024
1 parent 7a3bc3d commit e0398c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/api/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const logger = useLogger('websocket')

export default defineWebSocketHandler({
async open(peer) {
logger.info('New peer', peer)
logger.info('Peer connected', peer)

const storage = useStorage('data')
await storage.watch(async (_, key) => {
Expand All @@ -21,4 +21,7 @@ export default defineWebSocketHandler({
peer.send({ event: 'pong' })
}
},
async close(peer) {
logger.info('Peer disconnected', peer)
},
})

0 comments on commit e0398c0

Please sign in to comment.