Function: stompit.connect


Creates a stompit.Client object and connects to a server. The connectionListener callback (an observer of the client object's connect event) is called when the client is connected and is ready to send and subscribe.

The return value is a new client object.

Supported call patterns:

Options:

Options available when ssl is set to true:

Under the hood net.connect and tls.connect functions are used so any options they have available that are undocumented here are also applicable to stompit.connect function.

Standard headers

Set the connectHeaders option with an object containing the headers to be included in the connect frame. Below are the list of standard headers supported by STOMP servers.

Example

var connectOptions = {
  'host': 'localhost',
  'port': 61613,
  'connectHeaders':{
    'heart-beat': '1000,2000',
    'host': 'localhost',
    'login': 'username',
    'passcode': 'password'
  }
};

stompit.connect(connectOptions, function(error, client) {

});