Comparing version 8.12.0 to 8.13.0
@@ -992,3 +992,7 @@ /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Readable$" }] */ | ||
req.end(); | ||
if (opts.finishRequest) { | ||
opts.finishRequest(req, websocket); | ||
} else { | ||
req.end(); | ||
} | ||
} | ||
@@ -995,0 +999,0 @@ |
{ | ||
"name": "ws", | ||
"version": "8.12.0", | ||
"version": "8.13.0", | ||
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -21,2 +21,3 @@ "keywords": [ | ||
".": { | ||
"browser": "./browser.js", | ||
"import": "./wrapper.mjs", | ||
@@ -23,0 +24,0 @@ "require": "./index.js" |
@@ -158,2 +158,4 @@ # ws: a Node.js WebSocket library | ||
ws.on('error', console.error); | ||
ws.on('open', function open() { | ||
@@ -175,2 +177,4 @@ ws.send('something'); | ||
ws.on('error', console.error); | ||
ws.on('open', function open() { | ||
@@ -195,2 +199,4 @@ const array = new Float32Array(5); | ||
wss.on('connection', function connection(ws) { | ||
ws.on('error', console.error); | ||
ws.on('message', function message(data) { | ||
@@ -218,2 +224,4 @@ console.log('received: %s', data); | ||
wss.on('connection', function connection(ws) { | ||
ws.on('error', console.error); | ||
ws.on('message', function message(data) { | ||
@@ -241,2 +249,4 @@ console.log('received: %s', data); | ||
wss1.on('connection', function connection(ws) { | ||
ws.on('error', console.error); | ||
// ... | ||
@@ -246,2 +256,4 @@ }); | ||
wss2.on('connection', function connection(ws) { | ||
ws.on('error', console.error); | ||
// ... | ||
@@ -275,2 +287,6 @@ }); | ||
function onSocketError(err) { | ||
console.error(err); | ||
} | ||
const server = createServer(); | ||
@@ -280,2 +296,4 @@ const wss = new WebSocketServer({ noServer: true }); | ||
wss.on('connection', function connection(ws, request, client) { | ||
ws.on('error', console.error); | ||
ws.on('message', function message(data) { | ||
@@ -287,2 +305,4 @@ console.log(`Received message ${data} from user ${client}`); | ||
server.on('upgrade', function upgrade(request, socket, head) { | ||
socket.on('error', onSocketError); | ||
// This function is not defined on purpose. Implement it with your own logic. | ||
@@ -296,2 +316,4 @@ authenticate(request, function next(err, client) { | ||
socket.removeListener('error', onSocketError); | ||
wss.handleUpgrade(request, socket, head, function done(ws) { | ||
@@ -319,2 +341,4 @@ wss.emit('connection', ws, request, client); | ||
wss.on('connection', function connection(ws) { | ||
ws.on('error', console.error); | ||
ws.on('message', function message(data, isBinary) { | ||
@@ -339,2 +363,4 @@ wss.clients.forEach(function each(client) { | ||
wss.on('connection', function connection(ws) { | ||
ws.on('error', console.error); | ||
ws.on('message', function message(data, isBinary) { | ||
@@ -357,2 +383,4 @@ wss.clients.forEach(function each(client) { | ||
ws.on('error', console.error); | ||
ws.on('open', function open() { | ||
@@ -385,2 +413,4 @@ console.log('connected'); | ||
duplex.on('error', console.error); | ||
duplex.pipe(process.stdout); | ||
@@ -410,2 +440,4 @@ process.stdin.pipe(duplex); | ||
const ip = req.socket.remoteAddress; | ||
ws.on('error', console.error); | ||
}); | ||
@@ -420,2 +452,4 @@ ``` | ||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim(); | ||
ws.on('error', console.error); | ||
}); | ||
@@ -444,2 +478,3 @@ ``` | ||
ws.isAlive = true; | ||
ws.on('error', console.error); | ||
ws.on('pong', heartbeat); | ||
@@ -486,2 +521,3 @@ }); | ||
client.on('error', console.error); | ||
client.on('open', heartbeat); | ||
@@ -488,0 +524,0 @@ client.on('ping', heartbeat); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137122
3945
537