Options
All
  • Public
  • Public/Protected
  • All
Menu

Diffusion JavaScript API 6.10.4

Index

Enumerations

Classes

Interfaces

Type aliases

Events

Variables

Functions

Object literals

Type aliases

AnonymousConnectionAction

AnonymousConnectionAction: "deny" | "allow" | "abstain"

Action to be taken by the system authentication handler for connection attempts that do not provide a principal name and credentials.

Callback

Callback: function

An error callback

Type declaration

    • (error: any): U
    • Parameters

      • error: any

      Returns U

ConnectionOptions

ConnectionOptions: object

A complete map of ConnectionOptions to values.

Type declaration

Credentials

Credentials: string | Buffer | null | undefined

The credentials that a session uses to authenticate itself.

When running the Diffusion Client in a browser context, access to the Buffer api is made available through diffusion.buffer.

Int64SourceType

Int64SourceType: string | number | Buffer | Int64

A type that can be converted to an int64

Json

Json: JSON

Alias for the JSON interface to keep compatibility with old TypeScript definitions

JsonDataType

JsonDataType: JSONDataType

Alias for the JSONDataType interface to keep compatibility with old TypeScript definitions

ReconnectStrategy

ReconnectStrategy: function

A reconnection strategy

Type declaration

    • (reconnect: function, abort: function): void
    • Parameters

      • reconnect: function
          • (): void
          • Returns void

      • abort: function
          • (): void
          • Returns void

      Returns void

Result

Result: Promise<R>

A Result represents a promise for the result of an async operation.

It implements the full ES6 Promise specification and is in all respects equivalent to a Promise.

Adapted from https://www.npmjs.com/package/@types/es6-promise

SessionOptions

SessionOptions: Options

Alias for the Options interface to keep compatibility with old TypeScript definitions

StreamCallback

StreamCallback: function

A callback function type for Streams

Type declaration

    • (...args: any[]): void
    • Parameters

      • Rest ...args: any[]

      Returns void

StringSourceType

StringSourceType: string | object

A type that can be converted to a string

TypedArray

TypedArray: Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Float32Array | Float64Array

A typed array that can be passed as credentials

Events

close

close: function

Emitted when the Stream has been closed through completion or the underlying session has been closed. No further events will be emitted after this.

param

the reason why the stream was closed

Type declaration

    • (reason?: undefined | string): void
    • Parameters

      • Optional reason: undefined | string

      Returns void

error

error: function

Emitted when an error occurs in the Stream or in any of its listeners. No further events will be emitted after this.

Type declaration

    • (err: Error): void
    • the error that occurred

      Parameters

      • err: Error

      Returns void

Variables

Const buffer

buffer: object = Buffer as any

Access to the Buffer API that is packaged with diffusion.

This can be used in browsers that don't have a native Buffer class. It allows the creation of buffers for use with binary datatypes.

example
const buf = diffusion.buffer.from('Hello World', 'utf8')

Type declaration

  • constructor: function
    • new __type(str: string, encoding?: string | undefined): Buffer
    • new __type(size: number): Buffer
    • new __type(array: Uint8Array): Buffer
    • new __type(arrayBuffer: ArrayBuffer): Buffer
    • new __type(array: any[]): Buffer
    • new __type(buffer: Buffer): Buffer
    • Parameters

      • str: string
      • Optional encoding: string | undefined

      Returns Buffer

    • Parameters

      • size: number

      Returns Buffer

    • Parameters

      • array: Uint8Array

      Returns Buffer

    • Parameters

      • arrayBuffer: ArrayBuffer

      Returns Buffer

    • Parameters

      • array: any[]

      Returns Buffer

    • Parameters

      • buffer: Buffer

      Returns Buffer

  • poolSize: number
  • prototype: Buffer
  • alloc: function
    • alloc(size: number, fill?: string | number | Buffer | undefined, encoding?: string | undefined): Buffer
    • Parameters

      • size: number
      • Optional fill: string | number | Buffer | undefined
      • Optional encoding: string | undefined

      Returns Buffer

  • allocUnsafe: function
    • allocUnsafe(size: number): Buffer
    • Parameters

      • size: number

      Returns Buffer

  • allocUnsafeSlow: function
    • allocUnsafeSlow(size: number): Buffer
    • Parameters

      • size: number

      Returns Buffer

  • byteLength: function
    • byteLength(string: string | DataView | ArrayBuffer | Buffer, encoding?: string | undefined): number
    • Parameters

      • string: string | DataView | ArrayBuffer | Buffer
      • Optional encoding: string | undefined

      Returns number

  • compare: function
    • compare(buf1: Buffer, buf2: Buffer): number
    • Parameters

      • buf1: Buffer
      • buf2: Buffer

      Returns number

  • concat: function
    • concat(list: Buffer[], totalLength?: number | undefined): Buffer
    • Parameters

      • list: Buffer[]
      • Optional totalLength: number | undefined

      Returns Buffer

  • from: function
    • from(arrayBuffer: ArrayBuffer, byteOffset?: number | undefined, length?: number | undefined): Buffer
    • from(data: string | any[] | ArrayBuffer | Buffer): Buffer
    • from(str: string, encoding?: string | undefined): Buffer
    • Parameters

      • arrayBuffer: ArrayBuffer
      • Optional byteOffset: number | undefined
      • Optional length: number | undefined

      Returns Buffer

    • Parameters

      • data: string | any[] | ArrayBuffer | Buffer

      Returns Buffer

    • Parameters

      • str: string
      • Optional encoding: string | undefined

      Returns Buffer

  • isBuffer: function
    • isBuffer(obj: any): boolean
    • Parameters

      • obj: any

      Returns boolean

  • isEncoding: function
    • isEncoding(encoding: string): boolean
    • Parameters

      • encoding: string

      Returns boolean

Const build

build: string = "9012365b"

The build version of this client library

Const clients

clients: ClientControlOptionsNamespace = ClientControlOptions

Access to PropertyKeys

Const datatypes

datatypes: DataTypes = DataTypesImpl

Access to the datatypes namespace

Const errors

errors: object = ErrorReason

The ErrorReason enum

Type declaration

Const keys

keys: string[] = ['PUBLISH_VALUES_ONLY','SCHEMA','VALIDATE_VALUES','TIDY_ON_UNSUBSCRIBE','TIME_SERIES_EVENT_VALUE_TYPE','TIME_SERIES_RETAINED_RANGE','TIME_SERIES_SUBSCRIPTION_RANGE','DONT_RETAIN_VALUE','PERSISTENT','REMOVAL','OWNER','COMPRESSION','CONFLATION','PRIORITY']

Valid TopicSpecification keys

Const locks

locks: SessionLockOptionsNamespace = SessionLockOptions

Access to the locks namespace

Let onconnect

onconnect: function

Type declaration

    • (e: MessageEvent): void
    • Parameters

      • e: MessageEvent

      Returns void

Const selectors

selectors: TopicSelectors = new TopicSelectors()

Access to the selectors namespace

Const topicUpdate

topicUpdate: TopicUpdateNamespace = TopicUpdateNamespace

Access to the topicUpdate namespace

Const topics

topics: TopicsNamespace = topicsNamespace

Access to the topics namespace

Const version

version: string = "6.10.4"

The version of this client library in the form major.minor.patch

Functions

connect

  • connect(options: Options | string, sessionName?: undefined | string, workerJs?: undefined | string): Result<Session>
  • Connect to a specified Diffusion server. This will return a Result that will complete successfully if a session can be connected, or fail if an error was encountered.

    If the result is successful, the fulfilled handler will be called with a Session instance. This session will be in a connected state and may be used for subsequent API calls.

    If the result fails, the rejected handler will be called with an error reason.

    If sessionName and workerJs is supplied, then the call will create a shared session inside a shared WebWorker. If a shared session with that name already exists, this function will return an instance of the existing session. Shared sessions can only be created when running in a browser environment that supports the SharedWorker. For more information regarding shared sessions, see connectShared.

    Example:

    diffusion.connect('example.server.com').then((session) => {
        // Connected with a session
        console.log('Connected!', session);
    }).catch((error) => {
        // Connection failed
        console.log('Failed to connect', error);
    });

    Parameters

    • options: Options | string

      the options to construct the session with. If a string is supplied, it will be interpreted as the host option.

    • Optional sessionName: undefined | string

      the name of the shared session

    • Optional workerJs: undefined | string

      the location of the diffusion worker script

    Returns Result<Session>

    a Result for this operation

connectShared

  • connectShared(sessionName: string, workerJs: string): Result<Session>
  • Connect to a specified Diffusion server using a shared WebWorker session. This will return a Result that will complete successfully if a session can be connected, or fail if an error was encountered. Shared sessions can only be created when running in a browser environment that supports the SharedWorker.

    Shared sessions are identified by a name. If a shared session with that name already exists, this function will return an instance of the existing session. Otherwise the call will fail. Sessions can only be shared across scripts originating from a single domain. Otherwise the browser will create independent shared workers resulting in one shared session for each domain.

    The shared session will stay alive as long as there is an open browser tab that initiated a connection through the shared session. When the last tab is closed the shared worker holding the shared session will be terminated. The shared session is also expected to be terminated when the only tab holding a reference to the session is reloaded or experiences a page navigation. The exact behavior may be browser dependent.

    The workerJs argument must be set to the URL of the diffusion-worker.js supplied with the JavaScript distribution. The same-origin policy of the shared worker requires the calling script and the diffusion-worker.js to reside on the same domain.

    If the result is successful, the fulfilled handler will be called with a Session instance. This session will be in a connected state and may be used for subsequent API calls.

    If the result fails, the rejected handler will be called with an error reason.

    Example:

    const options = {
        host : 'localhost',
        port : '8080',
        principal : 'admin',
        credentials : 'password'
    };
    
    diffusion.connect(options, 'some-session', 'diffusion-worker.js').then((session) => {
        console.log('Connected creating new shared session', session);
    }).catch((error) => {
        console.log('Failed to connect', error);
    });
    
    diffusion.connectShared('some-session', 'diffusion-worker.js').then((session) => {
        console.log('Connected to existing shared session', session);
    }.catch((error) => {
        console.log('Failed to connect shared', error);
    });

    Parameters

    • sessionName: string

      the name of the shared session

    • workerJs: string

      the location of the diffusion worker script

    Returns Result<Session>

    a Result for this operation

escape

  • escape(s: string): string
  • Escapes special characters in a string that is to be used within a topic property or a session filter.

    This is a convenience method which inserts an escape character '' before any of the special characters ' " or .

    since

    6.1

    Parameters

    • s: string

      the string to be escaped

    Returns string

    the string value with escape characters inserted as appropriate

log

  • log(level: LogLevel | keyof LogLevel): void
  • Set the level of logging used by Diffusion. This will default to silent. Log levels are strings that represent different degrees of information to be logged. Available options are:

    • silent
    • error
    • warn
    • info
    • debug
    • trace

    Parameters

    • level: LogLevel | keyof LogLevel

      the log level to use

    Returns void

newBranchMappingTableBuilder

newRemoteServerBuilder

newSessionMetricCollectorBuilder

newTopicMetricCollectorBuilder

rolesToString

  • rolesToString(roles: Set<string> | string[]): string
  • Utility method which converts a set of authorisation roles to the string format required by the $Roles session property.

    since

    6.2

    Parameters

    • roles: Set<string> | string[]

      a set of roles

    Returns string

    a string representing the supplied roles, formatted as required by the $Roles session property

stringToRoles

  • stringToRoles(s: string): Set<string>
  • Utility method which converts a string of the format required by the $Roles session property into a mutable set of strings.

    since

    6.2

    Parameters

    • s: string

      the string with quoted roles separated by whitespace or commas

    Returns Set<string>

    set of roles

updateConstraints

  • Returns an update constraint factory.

    function

    diffusion#updateConstraints

    since

    6.2

    Returns UpdateConstraintFactory

    update constraint factory

Object literals

Const ClientControlOptions

ClientControlOptions: object

ANONYMOUS

ANONYMOUS: string = ""

Value returned by Session.getPrincipal if no principal name is associated with the session.

CloseReason

CloseReason: object = CloseReasonEnum

Type declaration

PropertyKeys

PropertyKeys: object = Object.freeze({/*** This constant can be used instead of a property key in requests for* session property values to indicate that <b>all</b> fixed session* properties are required.*/ALL_FIXED_PROPERTIES: ['*F'],/*** This constant can be used instead of a property key in requests for* session property values to indicate that <b>all</b> user defined session* properties are required.*/ALL_USER_PROPERTIES: ['*U'],/*** This constant can be used instead of a property key in requests for* session property values to indicate that <b>all</b> session* properties are required.*/ALL_PROPERTIES: ['*F', '*U'],/*** Session property key for session identifier.** @since 6.2*/SESSION_ID: '$SessionId',/*** Session property key for principal.** @since 6.2*/PRINCIPAL: '$Principal',/*** Session property key for connector name.** @since 6.2*/CONNECTOR: '$Connector',/*** Session property key for transport.** @since 6.2*/TRANSPORT: '$Transport',/*** Session property key for client type.** @since 6.2*/CLIENT_TYPE: '$ClientType',/*** Session property key for country code.** @since 6.2*/COUNTRY: '$Country',/*** Session property key for language code.** @since 6.2*/LANGUAGE: '$Language',/*** Session property key for server name.** @since 6.2*/SERVER_NAME: '$ServerName',/*** Session property key for client IP address.** @since 6.2*/CLIENT_IP: '$ClientIP',/*** Session property key for client latitude.** @since 6.2*/LATITUDE: '$Latitude',/*** Session property key for client longitude.** @since 6.2*/LONGITUDE: '$Longitude',/*** Session property key for client start time.** @since 6.2*/START_TIME: '$StartTime',/*** Session property key for session roles.** @since 6.2*/ROLES: '$Roles',/*** Session property key for MQTT client ID.** @since 6.6*/MQTT_CLIENT_ID: '$MQTTClientId',/*** Session property key for Gateway Client type.** @since 6.6*/GATEWAY_TYPE: '$GatewayType',/*** Session property key for Gateway Client identifier.** @since 6.6*/GATEWAY_ID: '$GatewayId'})

Dictionary containing standard session property keys

Example:

// Get the ALL_FIXED_PROPERTIES key
var props = diffusion.clients.PropertyKeys.ALL_FIXED_PROPERTIES;

Example:

// Get all user and fixed properties
var props = diffusion.clients.PropertyKeys.ALL_FIXED_PROPERTIES
     .concat(diffusion.clients.PropertyKeys.ALL_USER_PROPERTIES);

Type declaration

Const CloseReasonEnum

CloseReasonEnum: object

Enum representing the reason that the session has been closed.

Example:

diffusion.connect({...}).then(function(session) {...}, function(err) {
  switch(err) {
      case diffusion.clients.CloseReason.CLOSED_BY_CLIENT:
      // Do something
      case diffusion.clients.CloseReason.ACCESS_DENIED:
      // Do something else
      ...
  }
});

ACCESS_DENIED

ACCESS_DENIED: CloseReasonImpl = new CloseReasonImpl(99, 'The connection attempt was rejected by the server because authentication failed', false)

The connection attempt failed due to a security restraint or due to invalid credentials.

CLOSED_BY_CLIENT

CLOSED_BY_CLIENT: CloseReasonImpl = new CloseReasonImpl(0, 'The session was closed by the client', false)

The client requested close. Not recoverable.

CLOSED_BY_SERVER

CLOSED_BY_SERVER: CloseReasonImpl = new CloseReasonImpl(1, 'The session was closed by the server', false)

The session has been closed by the server, or another session using the ClientControl feature.

CONNECTION_ERROR

CONNECTION_ERROR: CloseReasonImpl = new CloseReasonImpl(7, 'The client could not establish a connection to the server', true)

The client could not establish a connection to the server.

An error was thrown while the client was attempting to connect to the server.

CONNECTION_TIMEOUT

CONNECTION_TIMEOUT: CloseReasonImpl = new CloseReasonImpl(3, 'The connection attempt timed out', false)

The connection attempt timed out, waiting for a response from the server.

The reconnection timeout can be controlled by the reconnect options.

HANDSHAKE_ERROR

HANDSHAKE_ERROR: CloseReasonImpl = new CloseReasonImpl(5, 'There was an error parsing the handshake response', false)

There was an error parsing the handshake response.

The client received a handshake response from the server but the response was malformed and could not be deserialised.

HANDSHAKE_REJECTED

HANDSHAKE_REJECTED: CloseReasonImpl = new CloseReasonImpl(4, 'The connection handshake was rejected by the server', false)

The connection handshake was rejected by the server.

The server responded with an unknown error code when the client attempted to connect.

IDLE_CONNECTION

IDLE_CONNECTION: CloseReasonImpl = new CloseReasonImpl(8, 'The activity monitor detected the connection was idle', true)

The client detected that the connection was idle.

The client has not received a ping message from the server for an extended period of time.

LICENSE_EXCEEDED

LICENSE_EXCEEDED: CloseReasonImpl = new CloseReasonImpl(18, 'The license limit was exceeded', false)

The connection request was rejected because the license limit was reached.

LOST_MESSAGES

LOST_MESSAGES: CloseReasonImpl = new CloseReasonImpl(16, 'Loss of messages has been detected', false)

Loss of messages from the client has been detected. For example, whilst waiting for the arrival of missing messages in a sequence of messages a timeout has occurred.

HTTP based transports use multiple TCP connections. This can cause the messages to be received out of order. To reorder the messages those sent to the server may contain a sequence number indicating the correct order.

If a message is received out of order there is a short time for the earlier messages to be received. If the messages are not received in this time the client is closed.

Missing, invalid or duplicate sequence numbers will also close the client for this reason.

This cannot be recovered from as the client and the server are in inconsistent states.

PROTOCOL_VERSION_MISMATCH

PROTOCOL_VERSION_MISMATCH: CloseReasonImpl = new CloseReasonImpl(17,'Client version rejected : Client should be downgraded to use server compatible version ' +'or server upgraded to client version in use',false)

The handshake response contained an incompatible protocol version.

The server does not support the client's protocol version.

The client version is later than the server version

RECONNECT_ABORTED

RECONNECT_ABORTED: CloseReasonImpl = new CloseReasonImpl(2, 'Client aborted a reconnect attempt', false)

Whilst disconnected, the client explicitly aborted a reconnect attempt.

TRANSPORT_ERROR

TRANSPORT_ERROR: CloseReasonImpl = new CloseReasonImpl(6, 'There was an unexpected error with the connection', true)

There was an unexpected error with the network connection.

The underlying transport (Websocket, XHR) received an error that could not be handled.

Const ErrorReason

ErrorReason: object

Enum containing reason codes used to report error conditions.

Some common ErrorReason values are defined as global constants. More specific reasons may be defined by individual features.

Example:

// Handle an error from the server
session.addStream('foo', diffusion.datatypes.string()).on('error', function(e) {
    if (e == diffusion.errors.ACCESS_DENIED) {
        // Handle authorisation error
    } else {
        // Log the problem
        console.log(e);
    }
});

ACCESS_DENIED

ACCESS_DENIED: ErrorReason = new ErrorReasonImpl(103, 'Access denied')

The request was rejected because the caller has insufficient permissions.

CALLBACK_EXCEPTION

CALLBACK_EXCEPTION: ErrorReason = new ErrorReasonImpl(105, 'An application callback threw an exception. Check logs for more information')

An application callback threw an exception. Check logs for more information.

CLUSTER_REPARTITION

CLUSTER_REPARTITION: ErrorReason = new ErrorReasonImpl(110, 'The cluster was repartitioning and the request could not be routed.')

A cluster operation failed because partition ownership changed during processing.

This is a transient error that occurs while the cluster is recovering from failure. The session can retry the operation.

CLUSTER_ROUTING

CLUSTER_ROUTING: ErrorReason = new ErrorReasonImpl(112, 'The cluster operation could not be routed.')

A cluster operation failed to be routed to a server within the cluster due to a communication failure, or the server that owns a partition is not currently known.

This is a transient error that occurs while the cluster is recovering from failure. The session can retry the operation.

COMMUNICATION_FAILURE

COMMUNICATION_FAILURE: ErrorReason = new ErrorReasonImpl(100, 'Communication with server failed')

Communication with the server failed.

HANDLER_CONFLICT

HANDLER_CONFLICT: ErrorReason = new ErrorReasonImpl(201, 'Conflict with an existing handler')

A conflicting registration exists on the server.

INCOMPATIBLE_DATATYPE

INCOMPATIBLE_DATATYPE: ErrorReason = new ErrorReasonImpl(108, 'Data type is incompatible')

An operation failed due to using an incompatible data type.

INCOMPATIBLE_STATE

INCOMPATIBLE_STATE: ErrorReason = new ErrorReasonImpl(111,'Topic operation not performed because it is managed by a component that prohibits external updates')

A topic update could not be performed because the topic is managed by a component (for example,fan-out) which prohibits external updates.

INVALID_DATA

INVALID_DATA: ErrorReason = new ErrorReasonImpl(106, 'Invalid data')

An operation failed because invalid data was received.

INVALID_PATH

INVALID_PATH: ErrorReason = new ErrorReasonImpl(202, 'Invalid path')

An invalid path was supplied.

NO_SUCH_SESSION

NO_SUCH_SESSION: ErrorReason = new ErrorReasonImpl(107, 'A requested session could not be found')

An operation failed because an addressed session could not be found.

REJECTED_REQUEST

REJECTED_REQUEST: ErrorReason = new ErrorReasonImpl(9003, 'A request has been rejected by the recipient session')

A recipient session has rejected a received message request.

REQUEST_TIME_OUT

REQUEST_TIME_OUT: ErrorReason = new ErrorReasonImpl(102, 'Request time out')

Communication with the server failed because a service request timed out.

SESSION_CLOSED

SESSION_CLOSED: ErrorReason = new ErrorReasonImpl(101, 'Session is closed')

Communication with the server failed because the session is closed.

TOPIC_TREE_REGISTRATION_CONFLICT

TOPIC_TREE_REGISTRATION_CONFLICT: ErrorReason = new ErrorReasonImpl(200, 'A conflicting registration exists on the same branch of the topic tree')

A conflicting registration exists on the same branch of the topic tree.

UNHANDLED_MESSAGE

UNHANDLED_MESSAGE: ErrorReason = new ErrorReasonImpl(109, 'A message was not handled')

A sent message was not handled by the specified recipient.

UNSUPPORTED

UNSUPPORTED: ErrorReason = new ErrorReasonImpl(104, 'Unsupported service')

The request was rejected because the requested operation is unsupported for this caller.

Const SessionLockOptions

SessionLockOptions: object

SessionLockScope

SessionLockScope: SessionLockScope = SessionLockScope

Const TopicAddFailReasonEnum

TopicAddFailReasonEnum: object

The reason that a topic could not be added.

Example:

session.topics.add('foo').then(function() { ... }, function(err) {
    switch (err) {
         case diffusion.topics.TopicAddFailReason.EXISTS:
             ...
         case diffusion.topics.TopicAddFailReason.INVALID_PATH:
             ...
    }
});

CLUSTER_REPARTITION

CLUSTER_REPARTITION: TopicAddFailReason = new TopicAddFailReason(10, 'When trying to create the topic the cluster was migrating the partition that owns the topic')

When trying to create the topic the cluster was migrating the partition that owns the topic. The correct owner could not be identified and the request failed. This is a transient failure for the duration of the partition migration.

EXCEEDED_LICENSE_LIMIT

EXCEEDED_LICENSE_LIMIT: TopicAddFailReason = new TopicAddFailReason(11, 'Adding the topic failed because of a license limit')

Adding the topic failed because of a license limit.

EXISTS

EXISTS: TopicAddFailReason = new TopicAddFailReason(1, 'The topic already exists with the same details')

The topic already exists with the same details.

EXISTS_INCOMPATIBLE

EXISTS_INCOMPATIBLE: TopicAddFailReason = new TopicAddFailReason(14, 'Adding the topic failed because a topic is already bound to the specified' +'path but the caller does not have the rights to manage it')

Adding the topic failed because a topic is already bound to the specified path but the caller does not have the rights to manage it.

This can be because the topic is being managed by a component with exclusive control over the topic, such as fan-out and thus the caller will not be able to update or remove the topic.

If the caller has suitable permissions then it could still subscribe to the topic, but the topic's specification may be different from that requested.

EXISTS_MISMATCH

EXISTS_MISMATCH: TopicAddFailReason = new TopicAddFailReason(2, 'The topic already exists, with different details')

The topic already exists, with different details.

INVALID_DETAILS

INVALID_DETAILS: TopicAddFailReason = new TopicAddFailReason(4, 'The topic details are invalid')

The topic details are invalid.

INVALID_NAME

INVALID_NAME: TopicAddFailReason = new TopicAddFailReason(15, 'The supplied topic path is invalid.')

The supplied topic path is invalid.

INVALID_PATH

INVALID_PATH: TopicAddFailReason = new TopicAddFailReason(3, 'The topic path is invalid')
deprecated

since 6.7

This value is not used and will be removed in a future release.

PERMISSIONS_FAILURE

PERMISSIONS_FAILURE: TopicAddFailReason = new TopicAddFailReason(7, 'Invalid permissions to add a topic at the specified path')

Invalid permissions to add a topic at the specified path.

UNEXPECTED_ERROR

UNEXPECTED_ERROR: TopicAddFailReason = new TopicAddFailReason(9, 'An unexpected error occured while creating the topic')

An unexpected error occured while creating the topic.

Const TopicTypeEnum

TopicTypeEnum: object

Enum containing possible Topic Types.

Example:

// Get a topic type for adding topics
var topicType = diffusion.topics.TopicType.JSON;

session.topics.add("foo", topicType);

BINARY

BINARY: TopicType = new TopicType(14, true, false)

Binary Topic.

This is a stateful topic that handles data in Binary format.

since

5.7

DOUBLE

DOUBLE: TopicType = new TopicType(19, true, false)

Topic that stores and publishes IEEE 754 double-precision floating point numbers (i.e native JavaScript Numbers). Based on the double data type.

Supports null Double values.

The topic does not support delta-streams - only complete values are transmitted.

since

6.0

INT64

INT64: TopicType = new TopicType(18, true, false)

Topic that stores and publishes 64-bit integer values. Based on the int64 data type. Values are of the type Int64.

Supports null int64 values.

Does not support delta-streams - only complete values are transmitted.

since

6.0

JSON

JSON: TopicType = new TopicType(15, true, false)

JSON (JavaScript Object Notation) Topic.

This is a stateful topic that handles data in JSON representation.

since

5.7

RECORD_V2

RECORD_V2: TopicType = new TopicType(20, true, false)

Topic that stores and publishes data in the form of records and fields. Based on the RecordV2 data type.

Supports delta-streams.

since

6.0

STRING

STRING: TopicType = new TopicType(17, true, false)

Topic that stores and publishes String values. Based on the string data type.

Supports null String values.

Supports delta-streams.

since

6.0

TIME_SERIES

TIME_SERIES: TopicType = new TopicType(16, true, false)

Time Series Topic.

A time series is a sequence of events. Each event contains a value and has server-assigned metadata comprised of a sequence number, timestamp, and author.

A time series topic allows sessions to access a time series that is maintained by the server. A time series topic has an associated event data type, such as Binary, String, or JSON, that determines the type of value associated with each event.

Retained range

The TIME_SERIES_SUBSCRIPTION_RANGE property configures the range of historic events retained by a time series topic. If the property is not specified, a time series topic will retain the ten most recent events.

Subscription range

The TIME_SERIES_SUBSCRIPTION_RANGE property configures a time series topic to send a range of historic events from the end of the time series to new subscribers. This is a convenient way to synchronize new subscribers without requiring the use of a range query.

By default, new subscribers will be sent the latest event if delta streams are enabled and no events if delta streams are disabled. See the description of Subscription range in the Session.timeseries time series feature} documentation.

Mandatory properties

The TIME_SERIES_EVENT_VALUE_TYPE property must be provided when creating a time series topic.

since

6.0

see

diffusion.datatypes.TimeSeriesDataType

UNKNOWN_TOPIC_TYPE

UNKNOWN_TOPIC_TYPE: TopicType = new TopicType(21, false, false)

A topic type that is unsupported by the session.

since

6.3

Const TopicUpdateNamespace

TopicUpdateNamespace: object

TopicCreationResult

TopicCreationResult: TopicCreationResult = TopicCreationResult

UpdateConstraintOperator

UpdateConstraintOperator: UpdateConstraintOperator = UpdateConstraintOperator

Const UnsubscribeReasonEnum

UnsubscribeReasonEnum: object

Enum containing reasons that an unsubscription occurred.

Example:

// Use UnsubscribeReason to validate unsubscription notifications
session.addStream('>foo', diffusion.datatypes.string())
       .on('unsubscribe', function(topic, specification, reason) {
    switch (reason) {
        case diffusion.topics.UnsubscribeReason.REMOVED :
            // Do something if the topic was removed
        default :
            // Do something else if the client was explicitly unsubscribed
    }
});

AUTHORIZATION

AUTHORIZATION: UnsubscribeReason = new UnsubscribeReason(3, 'Not authorized to subscribe to this topic')

The unsubscription occurred because the session is no longer authorized to access the topic.

since

5.9

BACK_PRESSURE

BACK_PRESSURE: UnsubscribeReason = new UnsubscribeReason(5, 'The server has unsubscribed due to a backlog of messages')

The server has a significant backlog of messages for the session, and the topic specification has the conflation topic property set to 'unsubscribe'. The session can resubscribe to the topic. The unsubscription is not persisted to the cluster. If the session fails over to a different server it will be resubscribed to the topic.

since

6.1

BRANCH_MAPPINGS

BRANCH_MAPPINGS: UnsubscribeReason = new UnsubscribeReason(6, 'Branch mapping rules have changed')

The unsubscription occurred because branch mapping rules changed.

since

6.7

see

SessionTrees

CONTROL

CONTROL: UnsubscribeReason = new UnsubscribeReason(1, 'The server or another client unsubscribed this client')

The server or another client unsubscribed this client.

REMOVED

REMOVED: UnsubscribeReason = new UnsubscribeReason(2, 'The topic was removed')

The topic was removed

REQUESTED

REQUESTED: UnsubscribeReason = new UnsubscribeReason(0, 'The unsubscription was requested by this client')

The unsubscription was requested by this client.

STREAM_CHANGE

STREAM_CHANGE: UnsubscribeReason = new UnsubscribeReason(undefined, 'A more specific stream has been registered to the same path')

A fallback stream has been unsubscribed or subscribed due to the addition or removal of a stream that selects the topic.

since

5.9

SUBSCRIPTION_REFRESH

SUBSCRIPTION_REFRESH: UnsubscribeReason = new UnsubscribeReason(undefined, 'The server has re-subscribed this session')

The server has re-subscribed this session to the topic. Existing streams are unsubscribed because the topic type and other attributes may have changed.

This can happen if a set of servers are configured to use session replication, and the session connected to one server reconnects ('fails over') to a different server.

A stream that receives an unsubscription notification with this reason will also receive a subscription notification with the new TopicSpecification.

since

5.9

UNKNOWN_UNSUBSCRIBE_REASON

UNKNOWN_UNSUBSCRIBE_REASON: UnsubscribeReason = new UnsubscribeReason(4, 'Unknown unsubscribe reason')

A reason that is unsupported by the session.

since

6.1

Const UpdateFailReasonEnum

UpdateFailReasonEnum: object

The reason that a topic could not be updated.

Example:

session.topics.update('foo', 'bar').then(function() { ... }, function(err) {
    switch (err) {
        case diffusion.topics.UpdateFailReason.MISSING_TOPIC:
            ...
        case diffusion.topics.UpdateFailReason.EXCLUSIVE_UPDATER_CONFLICT:
            ...
    }
});

CLUSTER_REPARTITION

CLUSTER_REPARTITION: UpdateFailReason = new UpdateFailReason(9, 'When trying to update the topic the cluster was migrating the partition that owns the topic')

An update to a replicated topic failed because the cluster was repartitioning due to a server starting, stopping, or failing. The session can retry the operation.

DELTA_WITHOUT_VALUE

DELTA_WITHOUT_VALUE: UpdateFailReason = new UpdateFailReason(8, 'An attempt has been made to apply a delta to a topic that does not yet have a value')

An attempt has been made to apply a delta to a topic that has not yet has a value specified for it.

EXCLUSIVE_UPDATER_CONFLICT

EXCLUSIVE_UPDATER_CONFLICT: UpdateFailReason = new UpdateFailReason(7, 'An exclusive update source is already registered for the topic branch')

Attempt to perform a non-exclusive update to a topic branch that already has an update source registered to it.

deprecated

Since 6.6

This value is no longer used and will be removed in a future release.

INCOMPATIBLE_STATE

INCOMPATIBLE_STATE: UpdateFailReason = new UpdateFailReason(10, 'An update could not be performed because the topic is managed by' +'a component (e.g fan-out) that prohibits updates from the caller')

An update could not be performed because the topic is managed by a component (e.g fan-out) that prohibits updates from the caller.

INCOMPATIBLE_UPDATE

INCOMPATIBLE_UPDATE: UpdateFailReason = new UpdateFailReason(1, 'Update type is incompatible with topic type')

The update was of a type that is not compatible with the topic it was submitted for, or the topic does not support updating.

INVALID_UPDATER

INVALID_UPDATER: UpdateFailReason = new UpdateFailReason(3, 'Updater is invalid for updating')

The updater used is not active.

deprecated

Since 6.6

This value is no longer used and will be removed in a future release.

INVALID_UPDATE_STREAM

INVALID_UPDATE_STREAM: UpdateFailReason = new UpdateFailReason(-2, 'The topic update failed because the update stream is no longer valid')

An update to a replicated topic failed because the cluster was repartitioning due to a server starting, stopping, or failing. The session can retry the operation.

MISSING_TOPIC

MISSING_TOPIC: UpdateFailReason = new UpdateFailReason(4, 'Topic does not exist')

The topic being updated does not exist.

UNSATISFIED_CONSTRAINT

UNSATISFIED_CONSTRAINT: UpdateFailReason = new UpdateFailReason(-1, 'The topic update failed because the constraint was not satisfied')

An update was not performed because the constraint was not satisfied.

UPDATE_FAILED

UPDATE_FAILED: UpdateFailReason = new UpdateFailReason(2, 'Update failed - possible content incompatibility')

The update failed, possibly because the content sent with the update was invalid/incompatible with topic type or data format.

Const topicsNamespace

topicsNamespace: object

FetchRequest

FetchRequest: FetchRequest = FetchRequest

TopicAddFailReason

TopicAddFailReason: object = TopicAddFailReasonEnum

Type declaration

TopicSpecification

TopicSpecification: TopicSpecification = TopicSpecification

TopicType

TopicType: object = TopicTypeEnum

Type declaration

UnsubscribeReason

UnsubscribeReason: object = UnsubscribeReasonEnum

Type declaration

UpdateFailReason

UpdateFailReason: object = UpdateFailReasonEnum

Type declaration