Skip to content

Commit

Permalink
[example] Use the WebSocket.WebSocket{,Server} aliases
Browse files Browse the repository at this point in the history
Closes #2034
  • Loading branch information
lpinca committed Apr 12, 2022
1 parent 62e9b19 commit 2cf6202
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/express-session-parse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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...');
Expand Down
4 changes: 2 additions & 2 deletions examples/server-stats/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
4 changes: 2 additions & 2 deletions examples/ssl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2cf6202

Please sign in to comment.