main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
881 bytes
|
Rev | Line | |
---|
[d24f17c] | 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
|
---|
| 7 | const uid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
|
---|
| 8 |
|
---|
| 9 | /** @type {PropertyDescriptor} */
|
---|
| 10 | const staticPropertyDescriptors = {
|
---|
| 11 | enumerable: true,
|
---|
| 12 | writable: false,
|
---|
| 13 | configurable: false
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | const states = {
|
---|
| 17 | CONNECTING: 0,
|
---|
| 18 | OPEN: 1,
|
---|
| 19 | CLOSING: 2,
|
---|
| 20 | CLOSED: 3
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | const opcodes = {
|
---|
| 24 | CONTINUATION: 0x0,
|
---|
| 25 | TEXT: 0x1,
|
---|
| 26 | BINARY: 0x2,
|
---|
| 27 | CLOSE: 0x8,
|
---|
| 28 | PING: 0x9,
|
---|
| 29 | PONG: 0xA
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | const maxUnsigned16Bit = 2 ** 16 - 1 // 65535
|
---|
| 33 |
|
---|
| 34 | const parserStates = {
|
---|
| 35 | INFO: 0,
|
---|
| 36 | PAYLOADLENGTH_16: 2,
|
---|
| 37 | PAYLOADLENGTH_64: 3,
|
---|
| 38 | READ_DATA: 4
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | const emptyBuffer = Buffer.allocUnsafe(0)
|
---|
| 42 |
|
---|
| 43 | module.exports = {
|
---|
| 44 | uid,
|
---|
| 45 | staticPropertyDescriptors,
|
---|
| 46 | states,
|
---|
| 47 | opcodes,
|
---|
| 48 | maxUnsigned16Bit,
|
---|
| 49 | parserStates,
|
---|
| 50 | emptyBuffer
|
---|
| 51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.