Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OptionsImpl

Implementation of the Options interface.

inheritdoc

Hierarchy

  • OptionsImpl

Implements

Index

Constructors

constructor

  • Create a new OptionsImpl instance

    The constructor takes a partially defined Options object and sets all undefined properties with their default values.

    Parameters

    • Default value options: Options = {}

      the options to create the instance from

    Returns OptionsImpl

Properties

activityMonitor

activityMonitor: boolean

A flag indicating whether to use the session activity monitor

connectionTimeout

connectionTimeout: number

The timeout in milliseconds used when connecting to the server. (default 10000)

Optional credentials

credentials: string | Uint8Array

A password string to authenticate with, a buffer containing custom credentials in binary format, a typed array, or a regular array of octets.

host

host: string

The hostname to connect to (default 'localhost')

Optional httpProxyAgent

httpProxyAgent: any

An optional HTTP/HTTPS proxy agent. (default undefined)

If this is set, then the client will attempt to connect to the Diffusion server via a proxy server.

The proxy agent will be passed to the WebSocket constructor as the agent option. See https://www.npmjs.com/package/https-proxy-agent for an example of a proxy agent.

This option is used for web socket connections and is intended for Node based clients only. Browser based clients will automatically use the browser's proxy settings.

Example:

const HttpsProxyAgent = require('https-proxy-agent');
const url = require('url');
const diffusion = require('diffusion');

const agent = new HttpsProxyAgent(url.parse('https://proxy.example.com:80'));

diffusion.connect({
  host: 'https://diffusion.foo.com',
  httpProxyAgent: agent
}).then((session) => {
 // connected through proxy server
});

maxMessageSize

maxMessageSize: number

The maximum size of messages that may be received from the server. (default 2147483647)

path

path: string

The request path used for connections (default /diffusion)

port

port: number | string

The port to connect to (default 443)

Optional principal

principal: undefined | string

The principal name this session should connect with. Used for authentication.

properties

properties: {}

An object of key-value pairs that define the user-defined session properties.

Property values will be sent as string values. Non-string properties must implement the toString() method to allow conversion.

For details of how session properties are used see Session.

Type declaration

  • [key: string]: string

reconnect

reconnect: { strategy: ReconnectStrategy; timeout: number }

Reconnection options. (default true)

Type declaration

retry

A retry strategy that defines the behaviour for the initial connection attempt.

The default strategy will attempt each transport once before cascading to the next transport.

secure

secure: boolean

Whether to use secure connections.

Optional tlsOptions

tlsOptions: ExtraTlsOptions

An optional TLS options object. (default undefined) This option is used for secure web socket connections and is intended for Node based clients only. Browser based clients will automatically use the browser's TLS settings.

See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions for more information.

transports

transports: string[]

The transports to be used for connection establishment. (default "WEBSOCKET")

Methods

with

  • Create a new Options object containing the union of this with additional options.

    Parameters

    • options: Options

      options to merge

    Returns Options

    the new options

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.