Skip to content

Commit

Permalink
fix(ws): update to new syntax in ws@3
Browse files Browse the repository at this point in the history
  • Loading branch information
justmoon committed Nov 23, 2017
1 parent 0130a1a commit eaea077
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/koa-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class KoaWebSocketServer {
this.server.on('connection', this.onConnection.bind(this))
}

onConnection (socket) {
onConnection (socket, upgradeReq) {
log.debug('Connection received')
socket.on('error', (err) => { log.debug('Error occurred:', err) })
const fn = compose(this.middleware)

const context = this.app.createContext(socket.upgradeReq)
const context = this.app.createContext(upgradeReq)
context.websocket = socket
context.path = url.parse(socket.upgradeReq.url).pathname
context.path = url.parse(upgradeReq.url).pathname

fn(context).catch((err) => { log.debug(err) })
}
Expand Down

0 comments on commit eaea077

Please sign in to comment.