Results 1 to 7 of 7

Threaded View

  1. #3
    Quote Originally Posted by giuseppe.corti View Post
    Hi vielktus,

    Do you confirm me that with the JavaScript Client library generator you have chose the "globals" style? Please consider that if you have chose the "AMD" style (default) you should change the js client code in order to use the require.js lib. Please refer to the "Example usage based on the chosen style" of the generator page.

    Anyway please consider that your js client code needs a couple of fix:
    - add port number to the Lightstreamer server url;
    - consider that by your adapters configuration the Adapter Set name is "MYSOCKET", and the Adapter name is not specified ("DEFAULT" assumed);

    ie:

    Code:
      var myClient = new LightstreamerClient("http://192.168.247.13:8080", "MYSOCKET"); 
      myClient.connect();
      
      var grid = new StaticGrid("hellogrid",true);
     
      var subscription = new Subscription("MERGE",grid.extractItemList(),grid.extractFieldList());
      // subscription.setDataAdapter("MYSOCKET");
      subscription.addListener(grid);
     
      myclient.subscribe(subscription);
    Okay, thats my bad :d. Im using AMD. But now i choose Global as you said. But its still no hope. I figure out this:

    This script Works:
    Code:
    <!DOCTYPE html><html>
      <head>
        <title>Hello World with Lightstreamer</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.7/require.min.js"></script>
        <script src="lightstreamer.js"></script>
      </head>
    
    
      <body>
        <div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="message">loading...</div>
        <div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="timestamp">loading...</div>
    
    
        <script>
          require(["LightstreamerClient","Subscription","StaticGrid"],function(LightstreamerClient,Subscription,StaticGrid) {
            var client = new LightstreamerClient("http://192.168.247.13:8080","MYSOCKET");
            client.connect();
    
    
            var grid = new StaticGrid("hellogrid",true);
    
    
            var subscription = new Subscription("MERGE",grid.extractItemList(),grid.extractFieldList());
            subscription.addListener(grid);
    
    
            client.subscribe(subscription);
          });
        </script>
      </body>
    </html>
    This script not works:
    Code:
    <!DOCTYPE html><html>
      <head>
        <title>Hello World with Lightstreamer</title>
        <script src="lightstreamer.js"></script>
      </head>
    
    
      <body>
        <div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="message">loading...</div>
        <div data-source="lightstreamer" data-grid="hellogrid" data-item="greetings" data-field="timestamp">loading...</div>
    
    
        <script>
            var myClient = new LightstreamerClient("http://192.168.247.13:8080","mysocket");
            myClient.connect();
            var grid = new StaticGrid("hellogrid",true);
    
    
            var subscription = new Subscription("MERGE",grid.extractItemList(),grid.extractFieldList());
            subscription.addListener(grid);
    
    
            myClient.subscribe(subscription);
        </script>
      </body>
    </html>
    I'm not sure about the lighstreamer.js and the require.min.js in the one works. Maybe i copied from the Demo, not the generator.

    But when i get one works to my Web on Apache, the one works still not works, i think i get stucked at the wrong Java script Included in Head tag:
    Code:
    <head>
    <title>Hello World with Lightstreamer</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.7/require.min.js"></script>
        <script src="lightstreamer.js"></script>
      </head>
    Can you help me to choose the right Java Script and the right <script>...</script> block to connect ?
    Last edited by vielktus; October 4th, 2013 at 08:37 AM.

 

 

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 12:57 AM.