# Class: Destination

## vertx-stomp-js/destination~ Destination

#### new Destination()

  Represents a STOMP destination. Depending on the implementation, the message delivery is different. Queue are sending message to only one subscribers, while topics are broadcasting the message to all subscribers.

  Implementations must be thread-safe.
  Source:
    - destination.js, line 37

### Methods

#### ack(connection, frame) → {boolean}

  Handles a `ACK` frame.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection
  `frame` | Object | the `ACK` frame

  Source:
    - destination.js, line 126

  ##### Returns:

  `true` if the destination has handled the frame (meaning it has sent the message with id)
  Type
    boolean

#### destination() → {string}

  Source:
    - destination.js, line 49

  ##### Returns:

  - the destination address.
  - Type
      string

#### dispatch(connection, frame) → {Destination}

  Dispatches the given frame.

  ##### Parameters:

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

  Source:
    - destination.js, line 64

  ##### Returns:

  the current instance of Destination
  Type
    Destination

#### getSubscriptions(connection) → {Array.<string>}

  Gets all subscription ids for the given destination hold by the given client

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection (client)

  Source:
    - destination.js, line 155

  ##### Returns:

  the list of subscription id, empty if none
  Type
    Array.<string>

#### matches(address) → {boolean}

  Checks whether or not the given address matches with the current destination.

  ##### Parameters:

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

  Source:
    - destination.js, line 183

  ##### Returns:

  `true` if it matches, `false` otherwise.
  Type
    boolean

#### nack(connection, frame) → {boolean}

  Handles a `NACK` frame.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection
  `frame` | Object | the `NACK` frame

  Source:
    - destination.js, line 141

  ##### Returns:

  `true` if the destination has handled the frame (meaning it has sent the message with id)
  Type
    boolean

#### numberOfSubscriptions() → {number}

  Gets the number of subscriptions attached to the current Destination.
  Source:
    - destination.js, line 169

  ##### Returns:

  the number of subscriptions.
  Type
    number

#### subscribe(connection, frame) → {Destination}

  Handles a subscription request to the current Destination.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection
  `frame` | Object | the `SUBSCRIBE` frame

  Source:
    - destination.js, line 80

  ##### Returns:

  the current instance of Destination
  Type
    Destination

#### unsubscribe(connection, frame) → {boolean}

  Handles a un-subscription request to the current Destination.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connection` | StompServerConnection | the connection
  `frame` | Object | the `UNSUBSCRIBE` frame

  Source:
    - destination.js, line 96

  ##### Returns:

  `true` if the un-subscription has been handled, `false` otherwise.
  Type
    boolean

#### unsubscribeConnection(connection) → {Destination}

  Removes all subscriptions of the given connection

  ##### Parameters:

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

  Source:
    - destination.js, line 110

  ##### Returns:

  the current instance of Destination
  Type
    Destination