Hi Megabyzus,
The list of Items (and also the list of fields) in a Subscription request is something that can not be changed dynamically during the life cycle of the subscription.
So, it would be necessary every time there is a change in the Item list to call unsubscribe and proceed with a new subscription request.
However, there are actually two better ways to handle this situation:
- The first is achievable if the client has full control over the dynamics with which the list of Items (which must be subscribed at any time) changes.
In this case it is possible for the client to make different subscription requests for each Item, so that every time a new Item needs to be subcribed a new subscription request will be processed; and every time an Item is no longer necessary an unsubscribe request for the specific subscription will be issued.
The application will be responsible for associating all subscription listeners to the same graphical widget.
This option is something similar to what is implemented in this demo:
https://demos.lightstreamer.com/GridDemo/
- The second option is advisable when a single client does not have control of the changes in the Items list which can also be determined by external events.
In this case, the server will keep the client updated with the list of Items currently to be displayed.
This is achieved with a COMMAND mode subscription; the client subscribes to a single Item and the server keeps a dynamic table updated with appropriate ADD, DELETE, and UPDATE commands.
This option is something similar to what is implemented in this demo:
https://demos.lightstreamer.com/PortfolioDemo/
Please let me know if one of the above scenarios applies to your use-case; and maybe we can expand on it.
Regards,
Giuseppe