addCookies static method

Future<void> addCookies(
  1. String uri,
  2. List<Cookie> cookies
)

Static method that can be used to share cookies between connections to the Server (performed by this library) and connections to other sites that are performed by the application.

With this method, cookies received by the application can be added (or replaced if already present) to the cookie set used by the library to access the Server. Obviously, only cookies whose domain is compatible with the Server domain will be used internally.

Lifecycle This method should be invoked before calling the LightstreamerClient.connect method. However it can be invoked at any time; it will affect the internal cookie set immediately and the sending of cookies on the next HTTP request or WebSocket establishment.

  • uri the URI from which the supplied cookies were received. It cannot be null.

  • cookies a list of cookies.

  • See getCookies

Implementation

static Future<void> addCookies(String uri, List<Cookie> cookies) async {
  var arguments = <String, dynamic>{
    'uri': uri,
    'cookies': cookies.map((e) => e.toString()).toList()
  };
  return await NativeBridge.instance.invokeMethod('LightstreamerClient.addCookies', arguments);
}