Results 1 to 10 of 21

Hybrid View

  1. #1
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121

    Creating Adapter in .net(C#)

    I have referred LightStreamer Demo and i have written the adapter in c#.

    In StandaloneLauncher.cs(in main function) file i have modified as

    string host = "localhost";
    int rrPortMD = 6650;
    int rrPortD = 6651;
    int notifPortD = 6652;
    string name = null;

    and i have modified the code in ExternalfeedSimulater.cs file with my real time data.

    And also i have created the adapters.xml file as

    <adapters_conf id="GARGTEST">


    <metadata_provider>
    <adapter_class>com.lightstreamer.adapters.remote.m etadata.NetworkedMetadataProvider</adapter_class>
    <param name="request_reply_port">6652</param>
    <param name="connection_recovery_timeout_millis">10000</param>
    <param name="first_connection_timeout_millis">10000</param>
    <param name="close_notifications_recovery">unneeded</param>
    </metadata_provider>


    <data_provider name="GARGADAPTER">
    <adapter_class>com.lightstreamer.adapters.remote.d ata.NetworkedDataProvider</adapter_class>
    <param name="request_reply_port">6650</param>
    <param name="notify_port">6651</param>
    <param name="connection_recovery_timeout_millis">10000</param>
    <param name="events_recovery">use_snapshot</param>
    </data_provider>


    </adapters_conf>

    My client file looking like,
    <script>
    var hostToUse = document.location.protocol == "file:" ? "http://localhost:8080/" : document.location.protocol+"//"+document.location.hostname+(document.location.po rt?":"+document.location.port:"");


    define("lsClient",["LightstreamerClient","StatusWidget"],function(LightstreamerClient,StatusWidget) {
    var lsClient = new LightstreamerClient("http://localhost:8880/","GARGTEST");
    lsClient.connectionSharing.enableSharing("RemoteSt ockListConnection", "ATTACH", "CREATE");
    lsClient.addListener(new StatusWidget("left", "0px", true));
    lsClient.connect();

    return lsClient;
    });
    </script>
    <script type="text/javascript">


    require(["lsClient","Subscription","StaticGrid"],
    function(lsClient,Subscription,StaticGrid) {

    var stocksGrid = new StaticGrid("stocks",true);
    stocksGrid.setAutoCleanBehavior(true,false);
    stocksGrid.addListener({
    onVisualUpdate: function(key,info) {
    if (info == null) {
    return;
    }
    var cold = (key.substring(4) % 2 == 1) ? "#eeeeee" : "#ddddee";
    info.setAttribute("yellow", cold, "backgroundColor");
    }
    });

    var stockSubscription = new Subscription("MERGE",stocksGrid.extractItemList(), stocksGrid.extractFieldList());
    stockSubscription.addListener(stocksGrid);
    stockSubscription.setDataAdapter("GARGADAPTER");
    stockSubscription.setRequestedSnapshot("yes");

    lsClient.subscribe(stockSubscription);
    });


    </script>


    In Lightstreamer/adapters/gargtest/lib i had put the file ls-proxy-adapters.jar

    But when i run this code getting error

    http://localhost:8880/lightstreamer/create_session.js creation failed(continuously trying to connect session but getting error)

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    If the create_session.js fails the most likely reason is that the Lightstreamer server is not listening on the specified port; this can happen if the startup procedure fails or never completes.
    But in your case, that involve remote Adapters, as long as a connection to a remote Metadata Adapter is still missing, all client requests will be refused.

    So, please check if the Lightstreamer server is started normally and that all the remote Adapters (port: 6650, 6651, 6652) are connected properly. If it is the case you can also post here some snippets of server log.

    Regards.

  3. #3
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    How to check all the remote Adapters (port: 6650, 6651, 6652) are connected properly in Lightstreamer. I used to monitor this like http://localhost:8880/monitor/ But i couldn't check.There is no option to view port

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    You are right, in the Lightstreamer monitor console you find mainly info about the clients connections and server status (memory and number of threads used ...).

    To verify that all Remote Adapters are connected you have to look in the server log ("LS_HOME / logs / lighstreamer.log") for pair of messages like these:


    Code:
    Waiting for a connection on port 6650...
    ...
    Connected on port 6650

  5. #5
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    I found the issue and corrected. Thank you very much.

    And i have one more doubt how to send response with different values for multiple client.

    1)In my case clients are separated by groups. If i connect all the clients with lightstreamer how can i identify clients belonging groups.
    2)How to send client id to server(ie: User id) based on the client id how to send response for respected clients

  6. #6
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    In a case like yours, that involves private messaging, you just need to add a little bit of implementation in your Metadata Adapter.

    We assume that on the client side you set the user ID by this function. On the adapter side, with the NotifyUser method you can identify the user and assign him to the correct group. Then in the GetItems method you can customize the Item (i.e. "MyItem" became "MyItem_GroupA" or "MyItem_GroupB" depending on which group the user belongs).

    Now you can feed the item "MyItem_GroupA", "MyItem_GroupB", ... independently with the quotes appropriately corrected and users will receive only those of their group in a transparent way.

    For a further discussion on the topic of private messages, please take a look at this thread.

    Hope that helps.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 10:50 PM.