Options
All
  • Public
  • Public/Protected
  • All
Menu

uWebSockets.js v20.4.0 documentation

Index

Type aliases

CompressOptions

CompressOptions: number

WebSocket compression options. Combine any compressor with any decompressor using bitwise OR.

RecognizedString

RecognizedString: string | ArrayBuffer | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array

Recognized string types, things C++ can read and understand as strings. "String" does not have to mean "text", it can also be "binary".

Ironically, JavaScript strings are the least performant of all options, to pass or receive to/from C++. This because we expect UTF-8, which is packed in 8-byte chars. JavaScript strings are UTF-16 internally meaning extra copies and reinterpretation are required.

That's why all events pass data by ArrayBuffer and not JavaScript strings, as they allow zero-copy data passing.

You can always do Buffer.from(arrayBuffer).toString(), but keeping things binary and as ArrayBuffer is preferred.

Variables

DEDICATED_COMPRESSOR_128KB

DEDICATED_COMPRESSOR_128KB: CompressOptions

Sliding dedicated compress window, requires 128KB of memory per socket

DEDICATED_COMPRESSOR_16KB

DEDICATED_COMPRESSOR_16KB: CompressOptions

Sliding dedicated compress window, requires 16KB of memory per socket

DEDICATED_COMPRESSOR_256KB

DEDICATED_COMPRESSOR_256KB: CompressOptions

Sliding dedicated compress window, requires 256KB of memory per socket

DEDICATED_COMPRESSOR_32KB

DEDICATED_COMPRESSOR_32KB: CompressOptions

Sliding dedicated compress window, requires 32KB of memory per socket

DEDICATED_COMPRESSOR_3KB

DEDICATED_COMPRESSOR_3KB: CompressOptions

Sliding dedicated compress window, requires 3KB of memory per socket

DEDICATED_COMPRESSOR_4KB

DEDICATED_COMPRESSOR_4KB: CompressOptions

Sliding dedicated compress window, requires 4KB of memory per socket

DEDICATED_COMPRESSOR_64KB

DEDICATED_COMPRESSOR_64KB: CompressOptions

Sliding dedicated compress window, requires 64KB of memory per socket

DEDICATED_COMPRESSOR_8KB

DEDICATED_COMPRESSOR_8KB: CompressOptions

Sliding dedicated compress window, requires 8KB of memory per socket

DEDICATED_DECOMPRESSOR

DEDICATED_DECOMPRESSOR: CompressOptions

Sliding dedicated decompress window, requires 32KB of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_16KB

DEDICATED_DECOMPRESSOR_16KB: CompressOptions

Sliding dedicated decompress window, requires 16KB of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_1KB

DEDICATED_DECOMPRESSOR_1KB: CompressOptions

Sliding dedicated decompress window, requires 1KB of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_2KB

DEDICATED_DECOMPRESSOR_2KB: CompressOptions

Sliding dedicated decompress window, requires 2KB of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_32KB

DEDICATED_DECOMPRESSOR_32KB: CompressOptions

Sliding dedicated decompress window, requires 32KB of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_4KB

DEDICATED_DECOMPRESSOR_4KB: CompressOptions

Sliding dedicated decompress window, requires 4KB of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_512B

DEDICATED_DECOMPRESSOR_512B: CompressOptions

Sliding dedicated decompress window, requires 512B of memory per socket (plus about 23KB)

DEDICATED_DECOMPRESSOR_8KB

DEDICATED_DECOMPRESSOR_8KB: CompressOptions

Sliding dedicated decompress window, requires 8KB of memory per socket (plus about 23KB)

DISABLED

DISABLED: CompressOptions

No compression (always a good idea if you operate using an efficient binary protocol)

SHARED_COMPRESSOR

SHARED_COMPRESSOR: CompressOptions

Zero memory overhead compression.

SHARED_DECOMPRESSOR

SHARED_DECOMPRESSOR: CompressOptions

Zero memory overhead decompression.

Functions

App

  • Constructs a non-SSL app. An app is your starting point where you attach behavior to URL routes. This is also where you listen and run your app, set any SSL options (in case of SSLApp) and the like.

    Parameters

    Returns TemplatedApp

SSLApp

getParts

us_listen_socket_close

us_socket_local_port

  • us_socket_local_port(socket: us_socket): number
  • Gets local port of socket (or listenSocket) or -1.

    Parameters

    Returns number

Generated using TypeDoc