Skip to content

Commit

Permalink
fix ws module
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenasm committed Jan 1, 2025
1 parent bfd49c4 commit a36272f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createServer as _createServer } from 'https';
import { createHash } from 'crypto';
import parsePrometheusTextFormat from 'parse-prometheus-text-format';

import { OPEN, Server } from 'ws';
import WebSocket from 'ws';
import express, { Router } from 'express';
import basicAuth from 'express-basic-auth';
import { v4 as uuidv4 } from 'uuid';
Expand Down Expand Up @@ -513,7 +513,7 @@ const addTaskMetricsToData = (data, lastRunningTasksMetrics) => {

const publish = (listeners, data) => {
listeners.forEach(listener => {
if (listener.readyState !== OPEN) return;
if (listener.readyState !== WebSocket.OPEN) return;

listener.send(JSON.stringify(data, null, 2));
});
Expand Down Expand Up @@ -669,7 +669,7 @@ if (enableHTTPS) {
const credentials = { key: privateKey, cert: certificate }
const httpsServer = _createServer(credentials);
httpsServer.on('request', app);
const wsServer = new Server({
const wsServer = new WebSocket.Server({
path: pathPrefix + '/stream',
server: httpsServer,
});
Expand All @@ -691,7 +691,7 @@ if (enableHTTPS) {
} else {
const httpServer = createServer();
httpServer.on('request', app);
const wsServer = new Server({
const wsServer = new WebSocket.Server({
path: pathPrefix + '/stream',
server: httpServer,
});
Expand Down

0 comments on commit a36272f

Please sign in to comment.