aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/undici/lib/web/websocket/constants.js
diff options
context:
space:
mode:
authorpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
committerpack <pack@packgekko.xyz>2026-08-09 10:37:07 +0000
commit55a4f1fc869e41aca748c63d3018f0448b1606e0 (patch)
treed132d1d01772b6d53faee3e63c534dea5706b78a /node_modules/undici/lib/web/websocket/constants.js
downloadcrud-55a4f1fc869e41aca748c63d3018f0448b1606e0.tar.gz
first commit
Diffstat (limited to 'node_modules/undici/lib/web/websocket/constants.js')
-rw-r--r--node_modules/undici/lib/web/websocket/constants.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/node_modules/undici/lib/web/websocket/constants.js b/node_modules/undici/lib/web/websocket/constants.js
new file mode 100644
index 0000000..2019b5b
--- /dev/null
+++ b/node_modules/undici/lib/web/websocket/constants.js
@@ -0,0 +1,66 @@
+'use strict'
+
+// This is a Globally Unique Identifier unique used
+// to validate that the endpoint accepts websocket
+// connections.
+// See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3
+const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
+
+/** @type {PropertyDescriptor} */
+const staticPropertyDescriptors = {
+ enumerable: true,
+ writable: false,
+ configurable: false
+}
+
+const states = {
+ CONNECTING: 0,
+ OPEN: 1,
+ CLOSING: 2,
+ CLOSED: 3
+}
+
+const sentCloseFrameState = {
+ NOT_SENT: 0,
+ PROCESSING: 1,
+ SENT: 2
+}
+
+const opcodes = {
+ CONTINUATION: 0x0,
+ TEXT: 0x1,
+ BINARY: 0x2,
+ CLOSE: 0x8,
+ PING: 0x9,
+ PONG: 0xA
+}
+
+const maxUnsigned16Bit = 2 ** 16 - 1 // 65535
+
+const parserStates = {
+ INFO: 0,
+ PAYLOADLENGTH_16: 2,
+ PAYLOADLENGTH_64: 3,
+ READ_DATA: 4
+}
+
+const emptyBuffer = Buffer.allocUnsafe(0)
+
+const sendHints = {
+ string: 1,
+ typedArray: 2,
+ arrayBuffer: 3,
+ blob: 4
+}
+
+module.exports = {
+ uid,
+ sentCloseFrameState,
+ staticPropertyDescriptors,
+ states,
+ opcodes,
+ maxUnsigned16Bit,
+ parserStates,
+ emptyBuffer,
+ sendHints
+}