Subscription

public class Subscription : CustomStringConvertible

Class representing a real-time subscription to be submitted to a Lightstreamer Server.

It contains subscription details and the delegates needed to process the real-time data.

After the creation, an Subscription object is in the “inactive” state. When an Subscription object is subscribed to on a LightstreamerClient object, through the LightstreamerClient.subscribe(_:) method, its state becomes “active”. This means that the client activates a subscription to the required items through Lightstreamer Server and the Subscription object begins to receive real-time events.

An Subscription can be configured to use either an Item Group or an Item List to specify the items to be subscribed to and using either a Field Schema or Field List to specify the fields.

“Item Group” and “Item List” are defined as follows:

  • “Item Group”: an Item Group is a String identifier representing a list of items. Such Item Group has to be expanded into a list of items by the getItems method of the MetadataProvider of the associated Adapter Set. When using an Item Group, items in the subscription are identified by their 1-based index within the group. It is possible to configure the Subscription to use an “Item Group” using the itemGroup property.

  • “Item List”: an Item List is an array of Strings each one representing an item. For the Item List to be correctly interpreted a LiteralBasedProvider or a MetadataProvider with a compatible implementation of getItems has to be configured in the associated Adapter Set. Note that no item in the list can be empty, can contain spaces or can be a number. When using an Item List, items in the subscription are identified by their name or by their 1-based index within the list. It is possible to configure the subscription to use an “Item List” using the items property or by specifying it in the constructor.

“Field Schema” and “Field List” are defined as follows:

  • “Field Schema”: a Field Schema is a String identifier representing a list of fields. Such Field Schema has to be expanded into a list of fields by the getFields method of the MetadataProvider of the associated Adapter Set. When using a Field Schema, fields in the subscription are identified by their 1-based index within the schema. It is possible to configure the Subscription to use a “Field Schema” using the fieldSchema property.

  • “Field List”: a Field List is an array of Strings each one representing a field. For the Field List to be correctly interpreted a LiteralBasedProvider or a MetadataProvider with a compatible implementation of getFields has to be configured in the associated Adapter Set. Note that no field in the list can be empty, or can contain spaces. When using a Field List, fields in the subscription are identified by their name or by their 1-based index within the list. It is possible to configure the Subscription to use a “Field List” using the fields property or by specifying it in the constructor.

  • The mode of a Subscription.

    See also

    mode
    See more

    Declaration

    Swift

    public enum Mode : String, CustomStringConvertible
  • Length to be requested to Lightstreamer Server for the internal queuing buffers for the items in a Subscription.

    See more

    Declaration

    Swift

    public enum RequestedBufferSize : Equatable, CustomStringConvertible
  • Maximum update frequency to be requested to Lightstreamer Server for all the items in a Subscription.

    See more

    Declaration

    Swift

    public enum RequestedMaxFrequency : Equatable, CustomStringConvertible
  • Snapshot delivery request for the items in a Subscription.

    See more

    Declaration

    Swift

    public enum RequestedSnapshot : Equatable, CustomStringConvertible
  • Creates an object to be used to describe a real-time 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 requestedMaxFrequency.

    Permitted values for subscription mode are:

    • MERGE

    • DISTINCT

    • RAW

    • COMMAND

    Declaration

    Swift

    public init(subscriptionMode: Mode)

    Parameters

    subscriptionMode

    The subscription mode for the items, required by Lightstreamer Server.

  • Creates an object to be used to describe a real-time 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 requestedMaxFrequency.

    Permitted values for subscription mode are:

    • MERGE

    • DISTINCT

    • RAW

    • COMMAND

    Precondition

    the specified “Field List” must be valid; see fields for details.

    Declaration

    Swift

    public convenience init(subscriptionMode: Mode, item: String, fields: [String])

    Parameters

    subscriptionMode

    The subscription mode for the items, required by Lightstreamer Server.

    item

    The item name to be subscribed to through Lightstreamer Server.

    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 fields and fieldSchema.

  • Creates an object to be used to describe a real-time 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 requestedMaxFrequency.

    Permitted values for subscription mode are:

    • MERGE

    • DISTINCT

    • RAW

    • COMMAND

    Precondition

    the specified “Item List” and “Field List” must be valid; see items and fields for details.

    Declaration

    Swift

    public convenience init(subscriptionMode: Mode, items: [String], fields: [String])

    Parameters

    subscriptionMode

    The subscription mode for the items, required by Lightstreamer Server.

    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 items and itemGroup.

    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 fields and fieldSchema.

  • Adds a delegate that will receive events from the Subscription instance.

    The same delegate can be added to several different Subscription instances.

    Lifecycle: a delegate can be added at any time. A call to add a delegate already present will be ignored.

    Declaration

    Swift

    public func addDelegate(_ delegate: SubscriptionDelegate)

    Parameters

    delegate

    An object that will receive the events as documented in the SubscriptionDelegate interface.

  • Removes a delegate from the Subscription instance so that it will not receive events anymore.

    Lifecycle: a delegate can be removed at any time.

    See also

    addDelegate(_:)

    Declaration

    Swift

    public func removeDelegate(_ delegate: SubscriptionDelegate)

    Parameters

    delegate

    The delegate to be removed.

  • List containing the SubscriptionDelegate instances that were added to this Subscription.

    See also

    addDelegate(_:)

    Declaration

    Swift

    public var delegates: [SubscriptionDelegate] { get }
  • Position of the “command” field in a COMMAND Subscription.

    This property can only be used if the Subscription mode is COMMAND and the Subscription was initialized using a “Field Schema”.

    Lifecycle: this property can be read at any time after the first SubscriptionDelegate.subscriptionDidSubscribe(_:) event.

    Declaration

    Swift

    public var commandPosition: Int? { get }
  • Position of the “key” field in a COMMAND Subscription.

    This property can only be accessed if the Subscription mode is COMMAND and the Subscription was initialized using a “Field Schema”.

    Lifecycle: this property can be read at any time.

    Declaration

    Swift

    public var keyPosition: Int? { get }
  • Name of the second-level Data Adapter (within the Adapter Set used by the current session) that supplies all the second-level items.

    All the possible second-level items should be supplied in MERGE mode with snapshot available.

    The Data Adapter name is configured on the server side through the “name” attribute of the <data_provider> element, in the adapters.xml file that defines the Adapter Set (a missing attribute configures the DEFAULT name).

    Default: the default Data Adapter for the Adapter Set, configured as DEFAULT on the Server.

    Lifecycle: this property can only be change while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public var commandSecondLevelDataAdapter: String? { get set }
  • The “Field List” to be subscribed to through Lightstreamer Server for the second-level items. It can only be used on COMMAND Subscriptions.

    Any change to this property will override any “Field List” or “Field Schema” previously specified for the second-level.

    Setting this property enables the two-level behavior: in synthesis, each time a new key is received on the COMMAND Subscription, the key value is treated as an Item name and an underlying Subscription for this Item is created and subscribed to automatically, to feed fields specified by this property. This mono-item Subscription is specified through an “Item List” containing only the Item name received. As a consequence, all the conditions provided for subscriptions through Item Lists have to be satisfied. The item is subscribed to in MERGE mode, with snapshot request and with the same maximum frequency setting as for the first-level items (including the unfiltered case). All other Subscription properties are left as the default. When the key is deleted by a DELETE command on the first-level Subscription, the associated second-level Subscription is also unsubscribed from.

    Specifying nil as parameter will disable the two-level behavior.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the field names in the “Field List” must not contain a space or be empty/nil.

    Precondition

    the Subscription must be currently “inactive”.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public var commandSecondLevelFields: [String]? { get set }
  • The “Field Schema” to be subscribed to through Lightstreamer Server for the second-level items. It can only be used on COMMAND Subscriptions.

    Any change to this property will override any “Field List” or “Field Schema” previously specified for the second-level.

    Setting this property enables the two-level behavior: in synthesis, each time a new key is received on the COMMAND Subscription, the key value is treated as an Item name and an underlying Subscription for this Item is created and subscribed to automatically, to feed fields specified by this property. This mono-item Subscription is specified through an “Item List” containing only the Item name received. As a consequence, all the conditions provided for subscriptions through Item Lists have to be satisfied. The item is subscribed to in MERGE mode, with snapshot request and with the same maximum frequency setting as for the first-level items (including the unfiltered case). All other Subscription properties are left as the default. When the key is deleted by a DELETE command on the first-level Subscription, the associated second-level Subscription is also unsubscribed from.

    Specifying nil as parameter will disable the two-level behavior.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public var commandSecondLevelFieldSchema: String? { get set }
  • Name of the Data Adapter (within the Adapter Set used by the current session) that supplies all the items for this Subscription.

    The Data Adapter name is configured on the server side through the “name” attribute of the <data_provider> element, in the adapters.xml file that defines the Adapter Set (a missing attribute configures the DEFAULT name).

    Note that if more than one Data Adapter is needed to supply all the items in a set of items, then it is not possible to group all the items of the set in a single Subscription. Multiple Subscriptions have to be defined.

    Default: the default Data Adapter for the Adapter Set, configured as DEFAULT on the Server.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var dataAdapter: String? { get set }
  • The “Field List” to be subscribed to through Lightstreamer Server.

    Any change to this property will override any “Field List” or “Field Schema” previously specified.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the field names in the list must not contain a space or be empty/nil.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var fields: [String]? { get set }
  • The “Field Schema” to be subscribed to through Lightstreamer Server.

    Any change to this property will override any “Field List” or “Field Schema” previously specified.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var fieldSchema: String? { get set }
  • The “Item Group” to be subscribed to through Lightstreamer Server.

    Any change to this property will override any “Item List” or “Item Group” previously specified.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var itemGroup: String? { get set }
  • The “Item List” to be subscribed to through Lightstreamer Server.

    Any change to this property will override any “Item List” or “Item Group” previously specified.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the item names in the “Item List” must not contain a space or be a number or be empty/nil.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var items: [String]? { get set }
  • The mode specified for this Subscription.

    Lifecycle: this property can be read at any time.

    Declaration

    Swift

    public var mode: Mode { get }
  • Length to be requested to Lightstreamer Server for the internal queuing buffers for the items in the Subscription.

    A Queuing buffer is used by the Server to accumulate a burst of updates for an item, so that they can all be sent to the client, despite of bandwidth or frequency limits. It can be used only when the Subscription mode is MERGE or DISTINCT and unfiltered dispatching has not been requested. If the value unlimited is supplied, then the buffer length is decided by the Server.

    Note that the Server may pose an upper limit on the size of its internal buffers.

    Format: an integer number (e.g. 10), or unlimited, or nil.

    Default: nil, meaning to lean on the Server default based on the Subscription mode. This means that the buffer size will be 1 for MERGE subscriptions and unlimited for DISTINCT subscriptions. See the “General Concepts” document for further details.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var requestedBufferSize: RequestedBufferSize? { get set }
  • Maximum update frequency to be requested to Lightstreamer Server for all the items in the Subscription.

    The maximum update frequency is expressed in updates per second and applies for each item in the Subscription; for instance, with a setting of 0.5, for each single item, no more than one update every 2 seconds will be received. If the value unlimited is supplied, then no frequency limit is requested. It is also possible to supply the value unfiltered, to ask for unfiltered dispatching, if it is allowed for the items, or a nil value stick to the Server default (which currently corresponds to unlimited).

    It can be used only if the Subscription mode is MERGE, DISTINCT or COMMAND (in the latter case, the frequency limitation applies to the UPDATE events for each single key). For Subscriptions with two-level behavior (see commandSecondLevelFields and commandSecondLevelFieldSchema), the specified frequency limit applies to both first-level and second-level items.

    Note that frequency limits on the items can also be set on the server side and this request can only be issued in order to furtherly reduce the frequency, not to rise it beyond these limits.

    This property can also be set to request unfiltered dispatching for the items in the Subscription. However, unfiltered dispatching requests may be refused if any frequency limit is posed on the server side for some item.

    Edition note: a further global frequency limit could also be imposed by the Server, depending on Edition and License Type; this specific limit also applies to RAW mode and to unfiltered dispatching. To know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, available at /dashboard).

    Format: a decimal number (e.g. 2.0), or unlimited, or unfiltered, or nil.

    Default: nil, meaning to lean on the Server default based on the Subscription . This consists, for all modes, in not applying any frequency limit to the subscription (the same as unlimited); see the “General Concepts” document for further details.

    Lifecycle: this property can be changed at any time with some differences based on the Subscription status:

    • If the Subscription instance is in its “inactive” state then the value can be changed at will.

    • If the Subscription instance is in its “active” state then the value can still be changed unless the current value is unfiltered or the supplied value is unfiltered or nil. If the Subscription instance is in its “active” state and the connection to the server is currently open, then a request to change the frequency of the Subscription on the fly is sent to the server.

    Precondition

    an error is raised if the Subscription is currently “active” and the current value of this property is nil or unfiltered.

    Precondition

    an error is raised if the Subscription is currently “active” and the given parameter is nil or unfiltered.

    Precondition

    an error is raised if the specified value is not nil nor one of the special unlimited and unfiltered values nor a valid positive number.

    Declaration

    Swift

    public var requestedMaxFrequency: RequestedMaxFrequency? { get set }
  • Enables/disables snapshot delivery request for the items in the Subscription.

    The snapshot delivery is expressed as yes/no to request/not request snapshot delivery (the check is case insensitive). If the Subscription mode is DISTINCT, instead of yes, it is also possible to supply an integer number, to specify the requested length of the snapshot (though the length of the received snapshot may be less than requested, because of insufficient data or server side limits); passing yes means that the snapshot length should be determined only by the Server. Nil is also a valid value; if specified, no snapshot preference will be sent to the server that will decide itself whether or not to send any snapshot.

    The snapshot can be requested only if the Subscription mode is MERGE, DISTINCT or COMMAND:

    • In case of a RAW Subscription only nil is a valid value;

    • In case of a non-DISTINCT Subscription only nil, yes and no are valid values.

    Format: yes, no, an integer number (e.g. 10), or nil.

    Default: yes if the Subscription mode is not RAW, nil otherwise.

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Precondition

    an error is raised if the specified value is not compatible with the mode of the Subscription.

    Declaration

    Swift

    public var requestedSnapshot: RequestedSnapshot? { get set }
  • The selector name for all the items in the Subscription.

    The selector is a filter on the updates received. It is executed on the Server and implemented by the Metadata Adapter.

    Default: nil (no selector).

    Lifecycle: this property can only be set while the Subscription instance is in its “inactive” state.

    Precondition

    the Subscription must be currently “inactive”.

    Declaration

    Swift

    public var selector: String? { get set }
  • Checks if the Subscription is currently “active” or not.

    Most of the Subscription properties cannot be modified if a Subscription is “active”.

    The status of an Subscription is changed to “active” through the LightstreamerClient.subscribe(_:) method and back to “inactive” through the LightstreamerClient.unsubscribe(_:) one.

    Lifecycle: this property can be read at any time.

    Declaration

    Swift

    public var isActive: Bool { get }
  • Checks if the Subscription is currently subscribed to through the server or not.

    This flag is switched to true by server sent subscription events, and back to false in case of client disconnection, LightstreamerClient.unsubscribe(_:) calls and server sent unsubscription events.

    Lifecycle: this property can be read at any time.

    Declaration

    Swift

    public var isSubscribed: Bool { get }
  • Returns the latest value received for the specified item/field pair.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    In case of COMMAND Subscriptions, the value returned by this method may be misleading, as in COMMAND mode all the keys received, being part of the same item, will overwrite each other; for COMMAND Subscriptions, use commandValueWithItemPos(_:key:fieldPos:) instead.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Lifecycle: this method can be called at any time; if called to retrieve a value that has not been received yet, then it will return nil.

    Declaration

    Swift

    public func valueWithItemPos(_ itemPos: Int, fieldPos: Int) -> String?

    Parameters

    itemPos

    The 1-based position of an item within the configured “Item Group” or “Item List”

    fieldPos

    The 1-based position of a field within the configured “Field Schema” or “Field List”

    Return Value

    The current value for the specified field of the specified item (possibly nil), or nil if no value has been received yet.

  • Returns the latest value received for the specified item/field pair.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    In case of COMMAND Subscriptions, the value returned by this method may be misleading, as in COMMAND mode all the keys received, being part of the same item, will overwrite each other; for COMMAND Subscriptions, use commandValueWithItemPos(_:key:fieldName:) instead.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Lifecycle: this method can be called at any time; if called to retrieve a value that has not been received yet, then it will return nil.

    Declaration

    Swift

    public func valueWithItemPos(_ itemPos: Int, fieldName: String) -> String?

    Parameters

    itemPos

    The 1-based position of an item within the configured “Item Group” or “Item List”

    fieldName

    An item in the configured “Field List”

    Return Value

    The current value for the specified field of the specified item (possibly nil), or nil if no value has been received yet.

  • Returns the latest value received for the specified item/field pair.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    In case of COMMAND Subscriptions, the value returned by this method may be misleading, as in COMMAND mode all the keys received, being part of the same item, will overwrite each other; for COMMAND Subscriptions, use commandValueWithItemName(_:key:fieldPos:) instead.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Lifecycle: this method can be called at any time; if called to retrieve a value that has not been received yet, then it will return nil.

    Declaration

    Swift

    public func valueWithItemName(_ itemName: String, fieldPos: Int) -> String?

    Parameters

    itemName

    An item in the configured “Item List”

    fieldPos

    The 1-based position of a field within the configured “Field Schema” or “Field List”

    Return Value

    The current value for the specified field of the specified item (possibly nil), or nil if no value has been received yet.

  • Returns the latest value received for the specified item/field pair.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    In case of COMMAND Subscriptions, the value returned by this method may be misleading, as in COMMAND mode all the keys received, being part of the same item, will overwrite each other; for COMMAND Subscriptions, use commandValueWithItemName(_:key:fieldName:) instead.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Lifecycle: this method can be called at any time; if called to retrieve a value that has not been received yet, then it will return nil.

    Declaration

    Swift

    public func valueWithItemName(_ itemName: String, fieldName: String) -> String?

    Parameters

    itemName

    An item in the configured “Item List”

    fieldName

    An item in the configured “Field List”

    Return Value

    The current value for the specified field of the specified item (possibly nil), or nil if no value has been received yet.

  • Returns the latest value received for the specified item/key/field combination. This method can only be used if the Subscription mode is COMMAND. Subscriptions with two-level behavior (see commandSecondLevelFields and commandSecondLevelFieldSchema) are also supported, hence the specified field can be either a first-level or a second-level one.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public func commandValueWithItemPos(_ itemPos: Int, key: String, fieldPos: Int) -> String?

    Parameters

    itemPos

    The 1-based position of an item within the configured “Item Group” or “Item List”

    key

    The value of a key received on the COMMAND Subscription.

    fieldPos

    The 1-based position of a field within the configured “Field Schema” or “Field List”

    Return Value

    The current value for the specified field of the specified key within the specified item (possibly nil), or nil if the specified key has not been added yet (note that it might have been added and then deleted).

  • Returns the latest value received for the specified item/key/field combination. This method can only be used if the Subscription mode is COMMAND. Subscriptions with two-level behavior (see commandSecondLevelFields and commandSecondLevelFieldSchema) are also supported, hence the specified field can be either a first-level or a second-level one.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public func commandValueWithItemPos(_ itemPos: Int, key: String, fieldName: String) -> String?

    Parameters

    itemPos

    The 1-based position of an item within the configured “Item Group” or “Item List”

    key

    The value of a key received on the COMMAND Subscription.

    fieldName

    A item in the configured “Field List”

    Return Value

    The current value for the specified field of the specified key within the specified item (possibly nil), or nil if the specified key has not been added yet (note that it might have been added and then deleted).

  • Returns the latest value received for the specified item/key/field combination. This method can only be used if the Subscription mode is COMMAND. Subscriptions with two-level behavior (see commandSecondLevelFields and commandSecondLevelFieldSchema) are also supported, hence the specified field can be either a first-level or a second-level one.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public func commandValueWithItemName(_ itemName: String, key: String, fieldPos: Int) -> String?

    Parameters

    itemName

    An item in the configured “Item List”

    key

    The value of a key received on the COMMAND Subscription.

    fieldPos

    The 1-based position of a field within the configured “Field Schema” or “Field List”

    Return Value

    The current value for the specified field of the specified key within the specified item (possibly nil), or nil if the specified key has not been added yet (note that it might have been added and then deleted).

  • Returns the latest value received for the specified item/key/field combination. This method can only be used if the Subscription mode is COMMAND. Subscriptions with two-level behavior (see commandSecondLevelFields and commandSecondLevelFieldSchema) are also supported, hence the specified field can be either a first-level or a second-level one.

    It is suggested to consume real-time data by implementing and adding a proper SubscriptionDelegate rather than probing this method.

    Note that internal data is cleared when the Subscription is unsubscribed from.

    Precondition

    the Subscription mode must be COMMAND.

    Declaration

    Swift

    public func commandValueWithItemName(_ itemName: String, key: String, fieldName: String) -> String?

    Parameters

    itemName

    An item in the configured “Item List”

    key

    The value of a key received on the COMMAND Subscription.

    fieldName

    An item in the configured “Field List”

    Return Value

    The current value for the specified field of the specified key within the specified item (possibly nil), or nil if the specified key has not been added yet (note that it might have been added and then deleted).

  • Declaration

    Swift

    public var description: String { get }