diff --git a/benchmark/servers/ws7.mjs b/benchmark/servers/ws7.mjs index cdf75052..99eccd0b 100644 --- a/benchmark/servers/ws7.mjs +++ b/benchmark/servers/ws7.mjs @@ -1,9 +1,10 @@ import ws from 'ws7'; +const WebSocketServer = ws.Server; import { ports } from './ports.mjs'; import { useServer } from '../../lib/use/ws.mjs'; import { schema } from './schema.mjs'; -const server = new ws.Server({ +const server = new WebSocketServer({ port: ports.ws7, path: '/graphql', }); diff --git a/src/__tests__/utils/tservers.ts b/src/__tests__/utils/tservers.ts index d2b672ed..d5f55afe 100644 --- a/src/__tests__/utils/tservers.ts +++ b/src/__tests__/utils/tservers.ts @@ -3,7 +3,7 @@ import http from 'http'; import { schema, pong } from '../fixtures/simple'; import { ServerOptions, Context } from '../../server'; -import ws from 'ws'; +import ws, { WebSocketServer } from 'ws'; import uWS from 'uWebSockets.js'; import Fastify from 'fastify'; import fastifyWebsocket from 'fastify-websocket'; @@ -98,12 +98,12 @@ async function getAvailablePort() { export async function startRawServer(): Promise<{ url: string; - server: ws.Server; + server: WebSocketServer; dispose: () => Promise; }> { const path = '/raw'; const port = await getAvailablePort(); - const server = new ws.Server({ port, path }); + const server = new WebSocketServer({ port, path }); // sockets to kick off on teardown const sockets = new Set(); @@ -141,7 +141,7 @@ export async function startWSTServer( const path = '/simple'; const emitter = new EventEmitter(); const port = await getAvailablePort(); - const wsServer = new ws.Server({ port, path }); + const wsServer = new WebSocketServer({ port, path }); // sockets to kick off on teardown const sockets = new Set();