GatewayMetadata

External interface


interface GatewayMetadata {
  namespace?: string | RegExp
  path?: string
  serveClient?: boolean
  adapter?: any
  parser?: any
  connectTimeout?: number
  pingTimeout?: number
  pingInterval?: number
  upgradeTimeout?: number
  maxHttpBufferSize?: number
  allowRequest?: (req: any, fn: (err: string | null | undefined, success: boolean) => void) => void
  transports?: Array<'polling' | 'websocket'>
  allowUpgrades?: boolean
  perMessageDeflate?: boolean | object
  httpCompression?: boolean | object
  wsEngine?: string
  initialPacket?: any
  cookie?: any | boolean
  cors?: CorsOptions
  allowEIO3?: boolean
  destroyUpgrade?: boolean
  destroyUpgradeTimeout?: number
}

See also

Properties

Property Description
namespace?: string | RegExp

The name of a namespace

path?: string

Name of the path to capture

serveClient?: boolean

Whether to serve the client files

adapter?: any

The adapter to use

parser?: any

The parser to use

connectTimeout?: number

How many ms before a client without namespace is closed

pingTimeout?: number

How many ms without a pong packet to consider the connection closed

pingInterval?: number

How many ms before sending a new ping packet

upgradeTimeout?: number

How many ms before an uncompleted transport upgrade is cancelled

maxHttpBufferSize?: number

How many bytes or characters a message can be, before closing the session (to avoid DoS).

allowRequest?: (req: any, fn: (err: string | null | undefined, success: boolean) => void) => void

A function that receives a given handshake or upgrade request as its first parameter, and can decide whether to continue or not. The second argument is a function that needs to be called with the decided information: fn(err, success), where success is a boolean value where false means that the request is rejected, and err is an error code.

transports?: Array<'polling' | 'websocket'>

The low-level transports that are enabled

allowUpgrades?: boolean

Whether to allow transport upgrades

perMessageDeflate?: boolean | object

Parameters of the WebSocket permessage-deflate extension (see ws module api docs). Set to false to disable.

httpCompression?: boolean | object

Parameters of the http compression for the polling transports (see zlib api docs). Set to false to disable.

wsEngine?: string

What WebSocket server implementation to use. Specified module must conform to the ws interface (see ws module api docs). Default value is ws. An alternative c++ addon is also available by installing uws module.

initialPacket?: any

An optional packet which will be concatenated to the handshake packet emitted by Engine.IO.

cookie?: any | boolean

Configuration of the cookie that contains the client sid to send as part of handshake response headers. This cookie might be used for sticky-session. Defaults to not sending any cookie.

cors?: CorsOptions

The options that will be forwarded to the cors module

allowEIO3?: boolean

Whether to enable compatibility with Socket.IO v2 clients

destroyUpgrade?: boolean

Destroy unhandled upgrade requests

destroyUpgradeTimeout?: number

Milliseconds after which unhandled requests are ended