Subscription constructor

Subscription(
  1. String mode, [
  2. List<String>? items,
  3. List<String>? fields
])

Creates an object to be used to describe a Subscription that is going to be subscribed to through Lightstreamer Server.

The object can be supplied to LightstreamerClient.subscribe and LightstreamerClient.unsubscribe, in order to bring the Subscription to "active" or back to "inactive" state.
Note that all of the methods used to describe the subscription to the server can only be called while the instance is in the "inactive" state; the only exception is setRequestedMaxFrequency.

  • mode the subscription mode for the items, required by Lightstreamer Server. Permitted values are:
  • MERGE
  • DISTINCT
  • RAW
  • COMMAND
- [items] an array of items to be subscribed to through Lightstreamer server.
It is also possible specify the "Item List" or "Item Group" later through [setItems] and [setItemGroup]. - [fields] an array of fields for the items to be subscribed to through Lightstreamer Server.
It is also possible to specify the "Field List" or "Field Schema" later through [setFields] and [setFieldSchema].

Throws IllegalArgumentException If no or invalid subscription mode is passed.

Throws IllegalArgumentException If either the items or the fields array is left null.

Throws IllegalArgumentException If the specified "Item List" or "Field List" is not valid; see setItems and setFields for details.

Implementation

Subscription(String mode, [ List<String>? items, List<String>? fields ]) :
  _id = 'sub${_idGenerator++}',
  _mode = mode,
  _items = items?.toList(),
  _fields = fields?.toList();