Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
constants.js67 linesDownload Raw Back to websocket
1'use strict'
2
3// This is a Globally Unique Identifier unique used
4// to validate that the endpoint accepts websocket
5// connections.
6// See https://www.rfc-editor.org/rfc/rfc6455.html#section-1.3
7const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
8
9/** @type {PropertyDescriptor} */
10const staticPropertyDescriptors = {
11  enumerable: true,
12  writable: false,
13  configurable: false
14}
15
16const states = {
17  CONNECTING: 0,
18  OPEN: 1,
19  CLOSING: 2,
20  CLOSED: 3
21}
22
23const sentCloseFrameState = {
24  NOT_SENT: 0,
25  PROCESSING: 1,
26  SENT: 2
27}
28
29const opcodes = {
30  CONTINUATION: 0x0,
31  TEXT: 0x1,
32  BINARY: 0x2,
33  CLOSE: 0x8,
34  PING: 0x9,
35  PONG: 0xA
36}
37
38const maxUnsigned16Bit = 2 ** 16 - 1 // 65535
39
40const parserStates = {
41  INFO: 0,
42  PAYLOADLENGTH_16: 2,
43  PAYLOADLENGTH_64: 3,
44  READ_DATA: 4
45}
46
47const emptyBuffer = Buffer.allocUnsafe(0)
48
49const sendHints = {
50  string: 1,
51  typedArray: 2,
52  arrayBuffer: 3,
53  blob: 4
54}
55
56module.exports = {
57  uid,
58  sentCloseFrameState,
59  staticPropertyDescriptors,
60  states,
61  opcodes,
62  maxUnsigned16Bit,
63  parserStates,
64  emptyBuffer,
65  sendHints
66}
67 
codekingpro/portable-devtools · Team Ai