Namespace: eFTL

eFTL

The eFTL library exports a single object called eFTL to the JavaScript root context. Programs use the eFTL object to connect to an eFTL server.
See:

Methods

connect(url, options)

Connect to an eFTL server.

This call returns immediately; connecting continues asynchronously. When the connection is ready to use, the eFTL library calls your onConnect callback, passing an eFTLConnection object that you can use to publish and subscribe.

A program that uses more than one server channel must connect separately to each channel.

Parameters:
Name Type Description
url string The call connects to the eFTL server at this URL. The URL can be in either of these forms:
  • ws://host:port/channel
  • wss://host:port/channel
Optionally, the URL can contain the username, password, and/or client identifier:
  • ws://username:password@host:port/channel?clientId=<identifier>
  • wss://username:password@host:port/channel?clientId=<identifier>
options object A JavaScript object holding properties and callbacks.
Properties
Name Type Argument Description
username string <optional>
Connect using this username if not specified with the URL.
password string <optional>
Connect using this password if not specified with the URL.
clientId string <optional>
Connect using this client identifier if not specified with the URL.
autoReconnectAttempts number <optional>
Specify the maximum number of autoreconnect attempts if the connection is lost.
autoReconnectMaxDelay number <optional>
Specify the maximum delay (in milliseconds) between autoreconnect attempts.
trustAll boolean <optional>
Specify true to skip eFTL server certificate authentication. This option should only be used during development and testing. See eFTL#setTrustCertificates.
onConnect onConnect <optional>
A new connection to the eFTL server is ready to use.
onError onError <optional>
An error prevented an operation.
onDisconnect onDisconnect <optional>
A connection to the eFTL server has closed.
onReconnect onReconnect <optional>
A connection to the eFTL server has re-opened and is ready to use.
See:

getVersion() → {string}

Get the version of the eFTL Java client library.
Returns:
The version of the eFTL Java client library.
Type
string

setTrustCertificates(certs)

Set the certificates to trust when making a secure connection.

Self-signed server certificates are not supported.

If you do not set a trust certificate the application trusts any server certificate.

This method is not supported by browsers. Browsers only trust certificate authorities that have been installed by the browser.

Parameters:
Name Type Description
certs string | Buffer | Array.<string> | Array.<Buffer> Trust these certificates.