# Class: MqttEndpoint

## vertx-mqtt-server-js/mqtt_endpoint~ MqttEndpoint

#### new MqttEndpoint()

Represents an MQTT endpoint for point-to-point communication with the remote MQTT client

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 35

### Methods

#### accept(sessionPresent) → {MqttEndpoint}

Sends the CONNACK message to the remote MQTT client with "connection accepted" return code. See MqttEndpoint#reject for refusing connection

##### Parameters:

Name | Type | Description
--- | --- | ---
`sessionPresent` | boolean | if a previous session is present

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 490

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### auth() → {MqttAuth}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 75

##### Returns:

the Authentication information as provided by the remote MQTT client

Type
  MqttAuth

#### autoKeepAlive(isAutoKeepAlive) → {MqttEndpoint}

Enable/disable auto keep alive (sending ping response)

##### Parameters:

Name | Type | Description
--- | --- | ---
`isAutoKeepAlive` | boolean | auto keep alive

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 242

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### clientIdentifier() → {string}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 59

##### Returns:

the client identifier as provided by the remote MQTT client

Type
  string

#### close()

Close the endpoint, so the connection with remote MQTT client

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 46

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

Set a close handler. This will be called when the MQTT endpoint is closed

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 457

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

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

Set a disconnect handler on the MQTT endpoint. This handler is called when a DISCONNECT message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 299

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### exceptionHandler(handler) → {MqttEndpoint}

Set an exception handler. This will be called when an error at protocol level happens

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 472

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### isAutoKeepAlive() → {boolean}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 256

##### Returns:

the auto keep alive status (sending ping response)

Type
  boolean

#### isCleanSession() → {boolean}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 139

##### Returns:

true when clean session is requested by the remote MQTT client

Type
  boolean

#### isConnected() → {boolean}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 269

##### Returns:

if the connection between remote client and local endpoint is established/open

Type
  boolean

#### isPublishAutoAck() → {boolean}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 228

##### Returns:

auto acknowledge status for publishing (in/out)

Type
  boolean

#### isSubscriptionAutoAck() → {boolean}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 200

##### Returns:

true when auto acknowledge status for subscription/unsubscription requests

Type
  boolean

#### keepAliveTimeSeconds() → {number}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 155

##### Returns:

the keep alive timeout (in seconds) specified by the remote MQTT client

Type
  number

#### lastMessageId() → {number}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 171

##### Returns:

the message identifier used for last published message

Type
  number

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

Set the pingreq handler on the MQTT endpoint. This handler is called when a PINGREQ message is received by the remote MQTT client. In any case the endpoint sends the PINGRESP internally after executing this handler.

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 442

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### pong() → {MqttEndpoint}

Sends the PINGRESP message to the remote MQTT client

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 631

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### protocolName() → {string}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 123

##### Returns:

the protocol name provided by the remote MQTT client

Type
  string

#### protocolVersion() → {number}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 107

##### Returns:

the protocol version required by the remote MQTT client

Type
  number

#### publish(topic, payload, qosLevel, isDup, isRetain) → {MqttEndpoint}

Sends the PUBLISH message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`topic` | string | topic on which the message is published
`payload` | Buffer | message payload
`qosLevel` | Object | quality of service level
`isDup` | boolean | if the message is a duplicate
`isRetain` | boolean | if the message needs to be retained

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 616

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishAcknowledge(publishMessageId) → {MqttEndpoint}

Sends the PUBACK message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`publishMessageId` | number | identifier of the PUBLISH message to acknowledge

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 552

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishAcknowledgeHandler(handler) → {MqttEndpoint}

Set the puback handler on the MQTT endpoint. This handler is called when a PUBACK message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 369

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishAutoAck(isPublishAutoAck) → {MqttEndpoint}

Enable/disable publishing (in/out) auto acknowledge

##### Parameters:

Name | Type | Description
--- | --- | ---
`isPublishAutoAck` | boolean | auto acknowledge status

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 214

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishComplete(publishMessageId) → {MqttEndpoint}

Sends the PUBCOMP message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`publishMessageId` | number | identifier of the PUBLISH message to acknowledge

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 597

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishCompleteHandler(handler) → {MqttEndpoint}

Set the pubcomp handler on the MQTT endpoint. This handler is called when a PUBCOMP message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 423

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishHandler(handler) → {MqttEndpoint}

Set the publish handler on the MQTT endpoint. This handler is called when a PUBLISH message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 351

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishReceived(publishMessageId) → {MqttEndpoint}

Sends the PUBREC message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`publishMessageId` | number | identifier of the PUBLISH message to acknowledge

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 567

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishReceivedHandler(handler) → {MqttEndpoint}

Set the pubrec handler on the MQTT endpoint. This handler is called when a PUBREC message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 387

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishRelease(publishMessageId) → {MqttEndpoint}

Sends the PUBREL message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`publishMessageId` | number | identifier of the PUBLISH message to acknowledge

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 582

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### publishReleaseHandler(handler) → {MqttEndpoint}

Set the pubrel handler on the MQTT endpoint. This handler is called when a PUBREL message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 405

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### reject(returnCode) → {MqttEndpoint}

Sends the CONNACK message to the remote MQTT client rejecting the connection request with specified return code. See MqttEndpoint#accept for accepting connection

##### Parameters:

Name | Type | Description
--- | --- | ---
`returnCode` | Object | the connect return code

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 506

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### setClientIdentifier(clientIdentifier) → {MqttEndpoint}

Set client identifier if not provided by the remote MQTT client (zero-bytes)

##### Parameters:

Name | Type | Description
--- | --- | ---
`clientIdentifier` | string | the client identifier

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 283

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### subscribeAcknowledge(subscribeMessageId, grantedQoSLevels) → {MqttEndpoint}

Sends the SUBACK message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`subscribeMessageId` | number | identifier of the SUBSCRIBE message to acknowledge
`grantedQoSLevels` | Array.<Object> | granted QoS levels for the requested topics

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 522

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

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

Set a subscribe handler on the MQTT endpoint. This handler is called when a SUBSCRIBE message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 315

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### subscriptionAutoAck(isSubscriptionAutoAck)

Enable/disable subscription/unsubscription requests auto acknowledge

##### Parameters:

Name | Type | Description
--- | --- | ---
`isSubscriptionAutoAck` | boolean | auto acknowledge status

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 187

#### unsubscribeAcknowledge(unsubscribeMessageId) → {MqttEndpoint}

Sends the UNSUBACK message to the remote MQTT client

##### Parameters:

Name | Type | Description
--- | --- | ---
`unsubscribeMessageId` | number | identifier of the UNSUBSCRIBE message to acknowledge

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 537

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

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

Set a unsubscribe handler on the MQTT endpoint. This handler is called when a UNSUBSCRIBE message is received by the remote MQTT client

##### Parameters:

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

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 333

##### Returns:

a reference to this, so the API can be used fluently

Type
  MqttEndpoint

#### will() → {MqttWill}

Source:
  - vertx-mqtt-server-js/mqtt_endpoint.js, line 91

##### Returns:

the Will information as provided by the remote MQTT client

Type
  MqttWill