diff --git a/index.js b/index.js index 21ee508..16b0bc9 100644 --- a/index.js +++ b/index.js @@ -182,17 +182,6 @@ function fastifyWebsocket (fastify, opts, next) { conn.destroy(error) } - const oldDefaultRoute = fastify.getDefaultRoute() - fastify.setDefaultRoute(function (req, res) { - if (req[kWs]) { - handleUpgrade(req, (connection) => { - noHandle.call(fastify, connection, req) - }) - } else { - return oldDefaultRoute(req, res) - } - }) - next() } diff --git a/test/router.test.js b/test/router.test.js index e1635d5..0ae0dad 100644 --- a/test/router.test.js +++ b/test/router.test.js @@ -457,7 +457,7 @@ test('Should open on registered path', t => { fastify.listen({ port: 0 }, err => { t.error(err) - const ws = new WebSocket('ws://localhost:' + (fastify.server.address()).port + '/echo/') + const ws = new WebSocket('ws://localhost:' + (fastify.server.address()).port + '/echo') ws.on('open', () => { t.pass() client.end()