Skip to content
Adam Rudd edited this page Feb 28, 2013 · 3 revisions

Top Level API

Introduction

These methods are the preferred method for generating mqtt clients and servers.

mqtt#createServer([listener])

Create a new MqttServer (see: MqttServer)

  • [listener] - callback called on server client event

mqtt#createSecureServer(keyPath, certPath, [listener])

Create a new MqttSecureServer

  • keyPath - path to private key file
  • certPath - path to corresponding public cert
  • [listener] - callback called on server client event

mqtt#createClient([port], [host], [options])

Create a new MqttClient (see: MqttClient)

  • [port] - broker port (default: 1883)
  • [host] - broker host (default: localhost)
  • [options] - connect options

mqtt#createSecureClient([port], [host], options)

Create a new secure MqttClient

  • [port] - broker port (default: 1883)
  • [host] - broker host (default: localhost)
  • options - connection options, must include keys:
    • keyPath - path to private key
    • certPath - path to corresponding public cert

mqtt#createConnection([port], [host], [callback])

Create a new MqttConnection (see: MqttConnection)

  • [port] - broker port (default: 1883)
  • [host] - broker host (default: localhost)
  • [callback] - fired on underlying stream connect
Clone this wiki locally