sarbao
Good morning,
Is it possibl eto run multiple LightstreamerClient in the same html page connected each one to different adapters/metadataadpaters ?. Thanks very much in advanced.
Sarbaó
Giuseppe Corti
Hi Sarbaó,
Yes I confirm you that it is possible to instantiate as many LightstreamerClient as needed by your HTML page. Please note that if the Adapter Set is the same you can create two or more Subscriptions for different Data Adapters through the same LightstreamerClient istance.
Ie, assuming that the configuration of the server-side includes two Adapter Sets, A and B; the first with two Data Adapters 1 and 2 and the second with only the Data Adapter 3. A client that wants to receive data from all 3 Data Adapters will be something like this:
[SYNTAX=JSCRIPT]
var lsClient_A = new LightstreamerClient(<ls_server>,"MY_ADAPTER_SET_A");
lsClient_A.connect();
var lsClient_B = new LightstreamerClient(<ls_server>,"MY_ADAPTER_SET_B");
lsClient_B.connect();
...
var subscription_1 = new Subscription("MERGE",[Item_list_1],[field_List_1]);
subscription_1.setDataAdapter("MY_DATA_ADAPTER_1");
...
var subscription_2 = new Subscription("DISTINCT",[Item_list_2],[field_List_2]);
subscription_2.setDataAdapter("MY_DATA_ADAPTER_2");
...
var subscription_3 = new Subscription("MERGE",[Item_list_3],[field_List_3]);
subscription_3.setDataAdapter("MY_DATA_ADAPTER_3");
...
lsClient_A.subscribe(subscription_1);
lsClient_A.subscribe(subscription_2);
lsClient_B.subscribe(subscription_3);
[/SYNTAX]
sarbao
Thanks very much Giuseppe. Does it mean that I can use two different MetaDataAdpaters one per each Adapter Set ?. Aslo, does it make sense that configuration or is better to merge both MetaDAtaAdapters to end with just one and multiple Data Adapters. I imagine this way I can use the same lightstreamer session for the application io opening two sessions one for each MetaData. Best regards and tks again for reply
Giuseppe Corti
Hi Sarbaó,
An Adapter Set is made up of one Metadata Adapter and one or multiple Data Adapters. This means that every Data Adapter existing in the Set must share the same authentication, authorization, and entitlement logic implemented in the Metadata Adapter.
One of the reasons why you might need to create different Adapter Sets is right the need to implement different logic in the Metadata Adapter.