Skip to content

Commit 1332a66

Browse files
committed
fix: websocket close messages code
This commit fixes the messages of WebSocket closes, where "code" would be displayed as undefined.
1 parent 7664b60 commit 1332a66

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ws.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ class WebSocket extends EventEmitter {
176176
})
177177

178178
socket.on('close', () => {
179-
this.emit('close')
179+
this.emit('close', 1006, null)
180180

181181
this.cleanup()
182182
})
183183

184184
socket.on('error', (err) => {
185185
this.emit('error', err)
186-
this.emit('close')
186+
this.emit('close', 1006, null)
187187

188188
this.cleanup()
189189
})

0 commit comments

Comments
 (0)