IPWorks IoT 2020 Node.js Edition

Questions / Feedback?

Connect Method

Connects to the remote host.

Syntax

stomp.connect(host, port, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method connects to the remote host. Calling this method is equivalent to setting the RemoteHost property to Host, setting RemotePort to Port, and then setting the Connected property to True.

By default the class will connect in plaintext. To enable SSL set SSLEnabled to True.

When connecting to a STOMP server, the class sends information from the following properties, if populated:

In addition to the above properties, the following configuration settings can be set before connecting (though in most cases this is not necessary):

  • SupportedVersions: Controls which STOMP versions the class advertises support for.
  • VirtualHost: Controls the virtual host to connect to. If left empty (default), the value from RemoteHost is used.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Node.js Edition - Version 20.0 [Build 8265]