From 2cf6202f8a023d98c0ee3435ba03a4c9ad855278 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 12 Apr 2022 21:32:23 +0200 Subject: [PATCH] [example] Use the `WebSocket.WebSocket{,Server}` aliases Closes #2034 --- examples/express-session-parse/index.js | 4 ++-- examples/server-stats/index.js | 4 ++-- examples/ssl.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/express-session-parse/index.js b/examples/express-session-parse/index.js index 8fc4ce029..28ea15412 100644 --- a/examples/express-session-parse/index.js +++ b/examples/express-session-parse/index.js @@ -5,7 +5,7 @@ const express = require('express'); const http = require('http'); const uuid = require('uuid'); -const WebSocket = require('../..'); +const { WebSocketServer } = require('..'); const app = express(); const map = new Map(); @@ -56,7 +56,7 @@ const server = http.createServer(app); // // Create a WebSocket server completely detached from the HTTP server. // -const wss = new WebSocket.Server({ clientTracking: false, noServer: true }); +const wss = new WebSocketServer({ clientTracking: false, noServer: true }); server.on('upgrade', function (request, socket, head) { console.log('Parsing session from request...'); diff --git a/examples/server-stats/index.js b/examples/server-stats/index.js index da1f95a3b..91d958d52 100644 --- a/examples/server-stats/index.js +++ b/examples/server-stats/index.js @@ -4,13 +4,13 @@ const express = require('express'); const path = require('path'); const { createServer } = require('http'); -const WebSocket = require('../../'); +const { WebSocketServer } = require('..'); const app = express(); app.use(express.static(path.join(__dirname, '/public'))); const server = createServer(app); -const wss = new WebSocket.Server({ server }); +const wss = new WebSocketServer({ server }); wss.on('connection', function (ws) { const id = setInterval(function () { diff --git a/examples/ssl.js b/examples/ssl.js index ad08632b1..a5e750b79 100644 --- a/examples/ssl.js +++ b/examples/ssl.js @@ -3,14 +3,14 @@ const https = require('https'); const fs = require('fs'); -const WebSocket = require('..'); +const { WebSocket, WebSocketServer } = require('..'); const server = https.createServer({ cert: fs.readFileSync('../test/fixtures/certificate.pem'), key: fs.readFileSync('../test/fixtures/key.pem') }); -const wss = new WebSocket.Server({ server }); +const wss = new WebSocketServer({ server }); wss.on('connection', function connection(ws) { ws.on('message', function message(msg) {