hungtt
Hi all,
I'm using DotNet to develope LightStreamer Server which is based on Portfolio Demo and Metadata Adapter, I have a problem:
When two clients or more subscribe the same item, I want to the only one client recieved that item.
Please give me the way to resolve that problem.
Thanks!
Dario Crivelli
You can keep track of the items currently being subscribed to through the NotifyNewTables and NotifyTablesClose callbacks invoked on your Metadata Adapter (a remote .NET Adapter, I suppose).
You just have to enable the notifications first, by returning true from WantsTablesNotifications.
With this information, you can then refuse a further subscription request based on the items involved by returning a CreditsException from the related invocation of NotifyNewTables.
Note that in case you are running multiple Server instances, the various instances of the Metadata Adapter have to share, in some way, the information on the item usage.
Also note that, when a client closes, its subscriptions may be kept alive for a few seconds by the Server and this may disturb a client starting in that timeframe (or just the same client, in case it was just refreshing).
If acting on request refusal were not a suitable implementation of your requirement, more sophisticated approaches could be discussed.