Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    The "adapters.xml" file you attached is good for the Java Adapter (inprocess) but with your PHP Remote Adapter you should use something like this:
    Code:
    <?xml version="1.0"?>
    <adapters_conf id="HELLOWORLD">
     
      <metadata_provider>
        <adapter_class>com.lightstreamer.adapters.metadata.LiteralBasedProvider</adapter_class>
      </metadata_provider>
     
      <data_provider>
        <adapter_class>com.lightstreamer.adapters.remote.data.NetworkedDataProvider</adapter_class>
          <param name="request_reply_port">7001</param>
          <param name="notify_port">7002</param>
          <param name="timeout">36000000</param>
      </data_provider>
     
    </adapters_conf>

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

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\lightsample

    Really I heartily thanking you,

    Just now i could get understand about Lightstreamer and its adapter and client files. Too much of thanks to you. Based on this i have to develop stock market rates to client. We are developing application for bullion client. In that we are getting market rates from one third party application and we will add some of the margin and will display to users. Now i used ajax with settimeout() function to read file and display to client browser for every 200 mil second. Please give me some ideas to do this using lightstreamer. I got some basic points if you give some ideas means i can improve my application using lightstreamer.

    And also i'm getting error in my php coding like
    Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\lightsample

    Because getting error by indeterminate looping
    while (true) {
    $qry = "0|UD3|S|greetings|S|".$sid."|B|0|S|message|S| Do you count the following?|S|timestamp|S|Count: ".$cnt."\n";
    fwrite($feed, $qry);
    $cnt++;
    sleep(2);
    }

    For this i have update php.ini file and changed max_execution_time = 36000000

    now my browser continuously running. Is there any problem by this

    How can i overcome this. Thanks advance
    Last edited by rvkvino; September 18th, 2013 at 01:03 PM.

  3. #13
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    716
    You can refer to this demo (the source code of the example is also provided) which shows a simple Stock-List client updated with real-time data generated by a simulator and injected via Lightstreamer. We provide example of the Adapter implementation both in Java and in C#.NET.

    Specifically about your case, you should build a Data Adapter that connects with the third-party application to receive the market rates and generate Items to which clients subscribe and receive all updates in real time.

    Do you mean that to every different users you should apply different margins or the margins are the same for all the clients?
    Based on this response there could be some different implementation choices.

    About "Maximum execution time ..." error please you can refer to this previous post:

    Hi,

    the file is intended to be launched from a command line as
    Code:

    php filename.php


    you can certainly try to run it as a page but

    you may have problems due to the php.ini configurations (not sure about this, it's some time since I had to work with php)
    the file contains a while(true) but the php runtime has a limit in the execution time, after that the execution will be stopped

    HTH
    but if you have no chance to run the PHP code from a command line and not as a page I do not have better suggestions than your solution of increase the timeout.

  4. #14
    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)

  5. #15
    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.

  6. #16
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784

  7. #17
    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

  8. #18
    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

  9. #19
    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

  10. #20
    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 05:00 PM.