Skip to content

Commit eaea077

Browse files
committed
fix(ws): update to new syntax in ws@3
See: websockets/ws#1099
1 parent 0130a1a commit eaea077

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/koa-websocket.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ class KoaWebSocketServer {
2222
this.server.on('connection', this.onConnection.bind(this))
2323
}
2424

25-
onConnection (socket) {
25+
onConnection (socket, upgradeReq) {
2626
log.debug('Connection received')
2727
socket.on('error', (err) => { log.debug('Error occurred:', err) })
2828
const fn = compose(this.middleware)
2929

30-
const context = this.app.createContext(socket.upgradeReq)
30+
const context = this.app.createContext(upgradeReq)
3131
context.websocket = socket
32-
context.path = url.parse(socket.upgradeReq.url).pathname
32+
context.path = url.parse(upgradeReq.url).pathname
3333

3434
fn(context).catch((err) => { log.debug(err) })
3535
}

0 commit comments

Comments
 (0)