Skip to content

Commit

Permalink
fix: websocket close messages code
Browse files Browse the repository at this point in the history
This commit fixes the messages of WebSocket closes, where "code" would be displayed as undefined.
  • Loading branch information
ThePedroo committed Mar 9, 2024
1 parent 7664b60 commit 1332a66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ class WebSocket extends EventEmitter {
})

socket.on('close', () => {
this.emit('close')
this.emit('close', 1006, null)

this.cleanup()
})

socket.on('error', (err) => {
this.emit('error', err)
this.emit('close')
this.emit('close', 1006, null)

this.cleanup()
})
Expand Down

0 comments on commit 1332a66

Please sign in to comment.