# 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:
  - vertx-stomp-js/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:
  - vertx-stomp-js/destination.js, line 125

##### Returns:

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

Type
  boolean

#### destination() → {string}

Source:
  - vertx-stomp-js/destination.js, line 48

##### 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:
  - vertx-stomp-js/destination.js, line 63

##### 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:
  - vertx-stomp-js/destination.js, line 154

##### 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:
  - vertx-stomp-js/destination.js, line 182

##### 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:
  - vertx-stomp-js/destination.js, line 140

##### 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:
  - vertx-stomp-js/destination.js, line 168

##### 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:
  - vertx-stomp-js/destination.js, line 79

##### 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:
  - vertx-stomp-js/destination.js, line 95

##### 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:
  - vertx-stomp-js/destination.js, line 109

##### Returns:

the current instance of Destination

Type
  Destination