connect method

Future<void> connect()

Operation method that requests to open a Session against the configured Lightstreamer Server.

When connect() is called, unless a single transport was forced through ConnectionOptions.setForcedTransport, the so called "Stream-Sense" mechanism is started: if the client does not receive any answer for some seconds from the streaming connection, then it will automatically open a polling connection.
A polling connection may also be opened if the environment is not suitable for a streaming connection.
Note that as "polling connection" we mean a loop of polling requests, each of which requires opening a synchronous (i.e. not streaming) connection to Lightstreamer Server.

Lifecycle Note that the request to connect is accomplished by the client in a separate thread; this means that an invocation to getStatus right after connect() might not reflect the change yet.
When the request to connect is finally being executed, if the current status of the client is not DISCONNECTED, then nothing will be done.

Throws IllegalStateException if no server address was configured.

⚠ WARNING ⚠ The completion of the returned Future indicates that the operation has been accepted and is in progress, but not necessarily completed. To receive notifications about events generated by the operation, it is necessary to register a ClientListener.

Implementation

Future<void> connect() async {
  var arguments = <String, dynamic>{
    "connectionDetails": connectionDetails._toMap(),
    "connectionOptions": connectionOptions._toMap(),
  };
  return await _invokeMethod('connect', arguments);
}