Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface InternalSession

Internal session interface

The following events are emitted:

  • transport-selected: a transport has been selected. Parameters: name the transport name
  • cascade: the transport is cascading
  • connect: the session has established a connection to the server. Parameter sessionId the session ID
  • disconnect: the session has been disconnected from the server. Parameter: reason: CloseReason the CloseReason
  • reconnect: the session has reconnected to the server
  • close: the session is closed: Parameter: reason: CloseReason the CloseReason
  • error: an error has occurred. Parameter error the error that has been raised

Hierarchy

Index

Methods

checkConnected

  • checkConnected(reject: function): boolean
  • Check if the session is connected

    If the session is not connected an error will be emitted on the session's stream

    Parameters

    • reject: function
        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns boolean

    true if the finite state machine is in the connected state

close

  • close(): void
  • Close the stream. This will emit a 'close' event to any assigned listeners. No further events will be emitted.

    Returns void

connect

  • connect(): void
  • Attempt to connect to the server

    Returns void

getOptions

  • Get the session's options

    Returns OptionsImpl

    the options

getPrincipal

  • getPrincipal(): string
  • Get the session principal

    Returns string

    the session principal

getRouting

  • Get the topic routing instance

    Returns TopicRouting

getServerMaximumMessageSize

  • getServerMaximumMessageSize(): number
  • Get the server's maximum message size.

    Returns number

getServiceLocator

  • Get the session's service locator

    Returns ServiceLocator

    a reference to the service locator

getServiceRegistry

  • Get the service registry

    Returns ServiceRegistry

    a reference to the service registry

getSessionId

  • Get the session ID

    Returns SessionId

    the session ID

getState

  • Get the current state

    Returns InternalSessionState

    the state of the finite state machine

getStreamRegistry

  • Get the stream registry

    Returns StreamRegistry

    the stream registry

isConnected

  • isConnected(): boolean
  • Query if the session is connected

    Returns boolean

    true if the finite state machine is in the connected state

isShared

  • isShared(): boolean
  • Query if the session is using a shared session

    Returns boolean

lock

  • Request a session lock

    Parameters

    Returns Result<SessionLock>

    a Result that resolves with the acquired session lock

off

  • Remove a listener from a specified event.

    Example:

    // Bind a single listener to the 'foo' event and then deregister it
    var listener = function() {};
    stream.on('foo', listener);
    stream.off('foo', listener);

    Example:

    // Bind a listener to the 'foo' event and deregister all listeners
    var listener = function() {};
    stream.on('foo', listener);
    stream.off('foo');

    Parameters

    • events: string | CallbackMap
    • Optional listener: StreamCallback

      the listener to remove. All listeners for the event are removed if this is not specified. This argument is ignored if the first argument is a CallbackMap.

    Returns Stream

    this stream.

on

  • Register listeners against events.

    A single listener may be bound to an event by passing the event name and listener function.

    Multiple listeners may be bound by passing in a CallbackMap, mapping event names to listener functions.

    Example:

    // Bind a single listener to the 'foo' event
    stream.on('foo', function(arg1, arg2) {
        console.log("Called for 'foo' event", arg1, arg2);
    });

    Example:

    // Bind multiple listeners
    stream.on({
        foo : function() { ... },
        bar : function() { ... },
        baz : function() { ... }
    });

    Parameters

    • events: string | CallbackMap

      the event name or CallbackMap mapping event names to listeners

    • Optional listener: StreamCallback

      the listener to bind to the event, if passed as string. This argument is ignored if the first argument is a CallbackMap.

    Returns Stream

    this stream.

onSystemPing

  • onSystemPing(): void
  • Handle system ping

    Returns void

setPrincipal

  • setPrincipal(newPrincipal: string): void
  • Set the principal of the session

    Parameters

    • newPrincipal: string

      the new principal

    Returns void