-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Description
Description
When maxPayloadExceeded is called, the dead flag is set on the Receiver.
This makes the Receiver ignore everything including the final close frame coming from the other peer to complete the closing handshake.
Since the handshake cannot be completed, the connection is only closed when the cleanup timeout expires.
Test case:
'use strict';
const WebSocket = require('ws');
const http = require('http');
const server = http.createServer();
const wss = new WebSocket.Server({
perMessageDeflate: false,
clientTracking: false,
maxPayload: 10,
server
});
wss.on('connection', (ws) => {
ws.on('error', (err) => {
console.log(err.stack);
ws.close();
server.close();
});
ws.on('message', () => {
ws.close();
server.close();
});
});
server.listen(3000, () => {
const ws = new WebSocket('ws://localhost:3000');
ws.on('open', () => ws.send('0123456789'));
});The process exits only when the cleanup timeout expires.
If the maxPayload option is removed, the process exits immediately as expected.
@LordMajestros, since you have implemented the feature, do you have any idea on how to fix this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels