Skip to content

Commit

Permalink
fix(App): route method define fix
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Websocket `.ws` method now uses default behavior of uWebSockets.js
  • Loading branch information
dalisoft committed Jun 4, 2021
1 parent ebf0e22 commit b7e982f
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,8 @@ export default class App {
return this;
}

ws(path, handler, options = {}) {
if (typeof handler === 'object') {
options = handler;
handler = null;
}

this._ws.push({ path, handler, options });

ws(path, options) {
this._ws.push({ path, options });
return this;
}

Expand Down Expand Up @@ -209,8 +203,8 @@ export default class App {
router.lookup(req, res);
});

_ws.forEach(({ path, handler, options }) => {
this._app.ws(path, handler, options);
_ws.forEach(({ path, options }) => {
this._app.ws(path, options);
});
// Cleanup GC
_ws.length = 0;
Expand Down

0 comments on commit b7e982f

Please sign in to comment.