# Class: StompServerHandler

## vertx-stomp-js/stomp_server_handler~ StompServerHandler

#### new StompServerHandler()

  STOMP server handler implements the behavior of the STOMP server when a specific event occurs. For instance, if let customize the behavior when specific STOMP frames arrives or when a connection is closed. This class has been designed to let you customize the server behavior. The default implementation is compliant with the STOMP specification. In this default implementation, not acknowledge frames are dropped.
  Source:
    - stomp_server_handler.js, line 42

### Methods

#### abortHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `ABORT` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 199

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### ackHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `ACK` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 250

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### authProvider(handler) → {StompServerHandler}

  Configures the to be used to authenticate the user.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | AuthProvider | the handler

  Source:
    - stomp_server_handler.js, line 309

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### beginHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `BEGIN` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 216

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### bridge(options) → {StompServerHandler}

  Configures the STOMP server to act as a bridge with the Vert.x event bus.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Object | the configuration options

  Source:
    - stomp_server_handler.js, line 476

  ##### Returns:

  the current StompServerHandler.
  Type
    StompServerHandler

#### closeHandler(handler) → {StompServerHandler}

  Configures the action to execute when a connection with the client is closed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 151

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### commitHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `COMMIT` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 182

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### connectHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `CONNECT` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 66

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### destinationFactory(factory) → {StompServerHandler}

  Configures the DestinationFactory used to create Destination objects.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `factory` | DestinationFactory | the factory

  Source:
    - stomp_server_handler.js, line 461

  ##### Returns:

  the current StompServerHandler.
  Type
    StompServerHandler

#### disconnectHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `DISCONNECT` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 233

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### getDestination(destination) → {Destination}

  Gets the destination with the given name.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `destination` | string | the destination

  Source:
    - stomp_server_handler.js, line 339

  ##### Returns:

  the Destination, `null` if not existing.
  Type
    Destination

#### getDestinations() → {Array.<Destination>}

  Source:
    - stomp_server_handler.js, line 325

  ##### Returns:

  - the list of destination managed by the STOMP server. Don't forget the STOMP interprets destination as opaque Strings.
  - Type
      Array.<Destination>

#### getOrCreateDestination(destination) → {Destination}

  Gets a Destination object if existing, or create a new one. The creation is delegated to the DestinationFactory.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `destination` | string | the destination

  Source:
    - stomp_server_handler.js, line 447

  ##### Returns:

  the Destination instance, may have been created.
  Type
    Destination

#### handle(arg0)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `arg0` | ServerFrame |

  Source:
    - stomp_server_handler.js, line 52

#### nackHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `NACK` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 267

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### onAck(connection, subscribe, messages) → {StompServerHandler}

  Method called by single message (client-individual policy) or a set of message (client policy) are acknowledged. Implementations must call the handler configured using StompServerHandler#onAckHandler.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection
  `subscribe` | Object | the `SUBSCRIBE` frame
  `messages` | Array.<Object> | the acknowledge messages

  Source:
    - stomp_server_handler.js, line 356

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### onAckHandler(handler) → {StompServerHandler}

  Configures the action to execute when messages are acknowledged.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 391

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### onAuthenticationRequest(server, login, passcode, handler) → {StompServerHandler}

  Called when the client connects to a server requiring authentication. It invokes the configured using StompServerHandler#authProvider.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `server` | StompServer | the STOMP server.
  `login` | string | the login
  `passcode` | string | the password
  `handler` | function | handler receiving the authentication result

  Source:
    - stomp_server_handler.js, line 288

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### onClose(connection)

  Called when the connection is closed. This method executes a default behavior and must calls the configured StompServerHandler#closeHandler if any.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection

  Source:
    - stomp_server_handler.js, line 168

#### onNack(connection, subscribe, messages) → {StompServerHandler}

  Method called by single message (client-individual policy) or a set of message (client policy) are not acknowledged. Not acknowledgment can result from a `NACK` frame or from a timeout (no `ACK` frame received in a given time. Implementations must call the handler configured using StompServerHandler#onNackHandler.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection
  `subscribe` | Object | the `SUBSCRIBE` frame
  `messages` | Array.<Object> | the acknowledge messages

  Source:
    - stomp_server_handler.js, line 376

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### onNackHandler(handler) → {StompServerHandler}

  Configures the action to execute when messages are not acknowledged.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 408

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### pingHandler(handler) → {StompServerHandler}

  Allows customizing the action to do when the server needs to send a `PING` to the client. By default it send a frame containing `EOL` (specification). However, you can customize this and send another frame. However, be aware that this may requires a custom client.

  The handler will only be called if the connection supports heartbeats.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the action to execute when a `PING` needs to be sent.

  Source:
    - stomp_server_handler.js, line 429

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### sendHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `SEND` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 134

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### stompHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `STOMP` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 83

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### subscribeHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `SUBSCRIBE` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 100

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler

#### unsubscribeHandler(handler) → {StompServerHandler}

  Configures the action to execute when a `UNSUBSCRIBE` frame is received.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | function | the handler

  Source:
    - stomp_server_handler.js, line 117

  ##### Returns:

  the current StompServerHandler
  Type
    StompServerHandler