Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kudos committed May 21, 2018
1 parent ff333bb commit a12987e
Show file tree
Hide file tree
Showing 4 changed files with 5,664 additions and 645 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ KoaWebSocketServer.prototype.listen = function (options) {
this.server.on('connection', this.onConnection.bind(this));
};

KoaWebSocketServer.prototype.onConnection = function(socket) {
KoaWebSocketServer.prototype.onConnection = function(socket, req) {
debug('Connection received');
socket.on('error', function (err) {
debug('Error occurred:', err);
});
const fn = co.wrap(compose(this.middleware));

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

fn(context).catch(function(err) {
debug(err);
Expand Down
Loading

0 comments on commit a12987e

Please sign in to comment.