Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MissingTopicHandler

Handler called when a client session subscribes or fetches using a topic selector that matches no topics. This interface must be implemented by the user.

Handler instances can be registered using addMissingTopicHandler.

class

MissingTopicHandler

Hierarchy

  • MissingTopicHandler

Index

Methods

onClose

  • onClose(path: string): void
  • Called when the handler is closed. The handler will be closed if the session is closed, or if the handler is unregistered.

    Once closed, no further calls will be made for the handler.

    Parameters

    • path: string

      the registration path

    Returns void

onError

  • onError(path: string, error: any): void
  • Notification of a contextual error related to this handler. This is analogous to an unchecked exception being raised. Situations in which onError is called include the session being closed before the handler is registered, a communication timeout, or a problem with the provided parameters. No further calls will be made to this handler.

    Parameters

    • path: string

      the registration path

    • error: any

      the error

    Returns void

onMissingTopic

  • Called when a client session requests a topic that does not exist, and the topic path belongs to part of the topic tree for which this handler was registered.

    Missing topic notifications only occur when using the deprecated Session.fetch mechanism. The newer Session.fetchRequest mechanism does not generate missing topic notifications.

    The handler implementation should take the appropriate action (for example, create the topic), and then call proceed on the supplied notification . This allows the client request to continue and successfully resolve against the topic if it was created.

    Alternatively, the handler can call cancel to discard the request. A handler should always call proceed or cancel , otherwise resources will continue to be reserved on the server until the notification times out.

    Parameters

    Returns void

onRegister

  • onRegister(path: string, deregister: function): void
  • Called when the handler has been successfully registered with the server.

    A session can register a single handler for a given branch of the topic tree. If there is already a handler registered for the topic path the operation will fail and onClose will be called.

    To deregister the handler, call the deregister function supplied.

    Parameters

    • path: string

      the registration path

    • deregister: function

      a function that may be called to deregister this handler. The function will resolve when the handler has been deregistered.

        • (): Promise<void>
        • Returns Promise<void>

    Returns void