Add <%br= %> jqhtml syntax docs, class override detection, npm update
Document event handler placement and model fetch clarification 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
21
node_modules/ws/lib/websocket.js
generated
vendored
21
node_modules/ws/lib/websocket.js
generated
vendored
@@ -18,6 +18,7 @@ const { isBlob } = require('./validation');
|
||||
|
||||
const {
|
||||
BINARY_TYPES,
|
||||
CLOSE_TIMEOUT,
|
||||
EMPTY_BUFFER,
|
||||
GUID,
|
||||
kForOnEventAttribute,
|
||||
@@ -32,7 +33,6 @@ const {
|
||||
const { format, parse } = require('./extension');
|
||||
const { toBuffer } = require('./buffer-util');
|
||||
|
||||
const closeTimeout = 30 * 1000;
|
||||
const kAborted = Symbol('kAborted');
|
||||
const protocolVersions = [8, 13];
|
||||
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
||||
@@ -88,6 +88,7 @@ class WebSocket extends EventEmitter {
|
||||
initAsClient(this, address, protocols, options);
|
||||
} else {
|
||||
this._autoPong = options.autoPong;
|
||||
this._closeTimeout = options.closeTimeout;
|
||||
this._isServer = true;
|
||||
}
|
||||
}
|
||||
@@ -629,6 +630,8 @@ module.exports = WebSocket;
|
||||
* times in the same tick
|
||||
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
||||
* automatically send a pong in response to a ping
|
||||
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
|
||||
* for the closing handshake to finish after `websocket.close()` is called
|
||||
* @param {Function} [options.finishRequest] A function which can be used to
|
||||
* customize the headers of each http request before it is sent
|
||||
* @param {Boolean} [options.followRedirects=false] Whether or not to follow
|
||||
@@ -655,6 +658,7 @@ function initAsClient(websocket, address, protocols, options) {
|
||||
const opts = {
|
||||
allowSynchronousEvents: true,
|
||||
autoPong: true,
|
||||
closeTimeout: CLOSE_TIMEOUT,
|
||||
protocolVersion: protocolVersions[1],
|
||||
maxPayload: 100 * 1024 * 1024,
|
||||
skipUTF8Validation: false,
|
||||
@@ -673,6 +677,7 @@ function initAsClient(websocket, address, protocols, options) {
|
||||
};
|
||||
|
||||
websocket._autoPong = opts.autoPong;
|
||||
websocket._closeTimeout = opts.closeTimeout;
|
||||
|
||||
if (!protocolVersions.includes(opts.protocolVersion)) {
|
||||
throw new RangeError(
|
||||
@@ -1290,7 +1295,7 @@ function senderOnError(err) {
|
||||
function setCloseTimer(websocket) {
|
||||
websocket._closeTimer = setTimeout(
|
||||
websocket._socket.destroy.bind(websocket._socket),
|
||||
closeTimeout
|
||||
websocket._closeTimeout
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1308,23 +1313,23 @@ function socketOnClose() {
|
||||
|
||||
websocket._readyState = WebSocket.CLOSING;
|
||||
|
||||
let chunk;
|
||||
|
||||
//
|
||||
// The close frame might not have been received or the `'end'` event emitted,
|
||||
// for example, if the socket was destroyed due to an error. Ensure that the
|
||||
// `receiver` stream is closed after writing any remaining buffered data to
|
||||
// it. If the readable side of the socket is in flowing mode then there is no
|
||||
// buffered data as everything has been already written and `readable.read()`
|
||||
// will return `null`. If instead, the socket is paused, any possible buffered
|
||||
// data will be read as a single chunk.
|
||||
// buffered data as everything has been already written. If instead, the
|
||||
// socket is paused, any possible buffered data will be read as a single
|
||||
// chunk.
|
||||
//
|
||||
if (
|
||||
!this._readableState.endEmitted &&
|
||||
!websocket._closeFrameReceived &&
|
||||
!websocket._receiver._writableState.errorEmitted &&
|
||||
(chunk = websocket._socket.read()) !== null
|
||||
this._readableState.length !== 0
|
||||
) {
|
||||
const chunk = this.read(this._readableState.length);
|
||||
|
||||
websocket._receiver.write(chunk);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user