From 54cc204473302eda7e6e7e75b343a14859524ab1 Mon Sep 17 00:00:00 2001 From: Essem Date: Mon, 24 Jun 2024 05:29:00 -0500 Subject: [PATCH] Use WebSocketServer instead of WebSocket.Server in streaming (#30788) --- streaming/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/streaming/index.js b/streaming/index.js index 154ecbc02..65a63bb11 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -12,7 +12,7 @@ import { Redis } from 'ioredis'; import { JSDOM } from 'jsdom'; import pg from 'pg'; import pgConnectionString from 'pg-connection-string'; -import WebSocket from 'ws'; +import { WebSocketServer } from 'ws'; import { AuthenticationError, RequestError, extractStatusAndMessage as extractErrorStatusAndMessage } from './errors.js'; import { logger, httpLogger, initializeLogLevel, attachWebsocketHttpLogger, createWebsocketLogger } from './logging.js'; @@ -289,7 +289,7 @@ const CHANNEL_NAMES = [ const startServer = async () => { const pgPool = new pg.Pool(pgConfigFromEnv(process.env)); const server = http.createServer(); - const wss = new WebSocket.Server({ noServer: true }); + const wss = new WebSocketServer({ noServer: true }); // Set the X-Request-Id header on WebSockets: wss.on("headers", function onHeaders(headers, req) {