Results 1 to 9 of 9

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    recreate the issue

    I'm going to go from the basics...

    I created a simple web client that uses a nonvisual table.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Lightstreamer :: Basic Stock-List Demo</title>
    <link rel="stylesheet" type="text/css" href="css/table.css" />

    <!-- load Lightstreamer libraries -->
    <script src="ls/lscommons.js" type="text/javascript"></script>
    <script src="ls/lspushpage.js" type="text/javascript"></script>
    </head>

    <body>
    <table width="766" border="0">
    <tr>
    <td><a href="http://www.lightstreamer.com" target="_blank">
    <img src="images/logo.gif" alt="LIGHTSTREAMER" hspace="0" border="0" /></a></td>
    <td class="demoTitle">demo basic</td>
    </tr>
    </table>

    <br />

    <div id="test2">This is a test</div>
    <div id="testnon">--</div>
    <script type="text/javascript">


    //////////////// Master Push-Page Configuration

    var pushPage = new PushPage();
    pushPage.context.setDebugAlertsOnClientError(true) ; // (set false in production)
    pushPage.context.setDomain()// (set the domain when deploying on web server)

    pushPage.onEngineCreation = function(lsEngine) {
    lsEngine.context.setDebugAlertsOnClientError(true) ; // (set false in production)
    lsEngine.connection.setLSHost(null); // (set the hostname when deploying on web server)
    lsEngine.connection.setLSPort(null); // (set the port when deploying on web server)
    lsEngine.connection.setAdapterName("MY_REAL_TIME") ;
    //lsEngine.policy.setMaxBandwidth(40); // ignored in Moderato and Allegro editions
    lsEngine.changeStatus("STREAMING");
    };

    pushPage.bind();
    pushPage.createEngine("MyCommonEngine", "ls/", "SHARE_SESSION", true);
    // both group and schema need to be defined by the backend
    var nvTable = new NonVisualTable("a","b","MERGE");
    nvTable.setSnapshotRequired(true);
    nvTable.setRequestedMaxFrequency(1.0);
    nvTable.setDataAdapter("DEMO");
    pushPage.addTable(nvTable , "nlist");
    nvTable.onItemUpdate = function(itemIndex,update,itemName) {
    document.getElementById("testnon").innerHTML =update.getNewValue("last_price");

    }
    </script></body></html>
    My Meta adapter needs to determine both group and schema.
    package stocklist_demo.adapters;

    import com.lightstreamer.interfaces.metadata.*;

    /**
    * Created by IntelliJ IDEA.
    * User: admin
    * Date: Feb 5, 2009
    * Time: 5:25:10 PM
    * To change this template use File | Settings | File Templates.
    */
    public class MyMetaAdapter extends MetadataProviderAdapter {

    public String[] getItems(String user, String session, String id) throws ItemsException {
    //TODO return items depending on id
    return new String[] {"item1","item2","item3"};
    }

    public String[] getSchema(String user, String session, String groupId, String schema) throws ItemsException, SchemaException {
    //TODO return customized schema
    return new String[] {"last_price", "ref_price", "open_price"};
    }


    public void notifyUser(String user, String password,java.util.Map httpHeaders) throws AccessException, CreditsException {
    if (!authenticate(user, password)) {
    throw new AccessException("Unauthorized user");
    }

    }

    private boolean authenticate(String userName, String password){

    //do authentication here
    return true;
    }


    }
    I use the StockListDemo_DataAdapter as it is.

    My log looks like this.

  2. #2
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    log -- continue---

    i've attached the log file

    Thanks
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30
    It works fine if I set the schema in the web client. But in my case I'm aiming to determine the schema in the meta adapter depending on the groupid and schema id.

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    the problem here is that your client doesn't know the names of your fields because you're creating your table with a schema name (string) instead of using a field list (array of strings)



    this way you can't access the fields by name as the library doesn't know at all how the schema was expanded by your metadata adapter, but you should access them by index



    let me know if you need further help.

  5. #5
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    Yes. Thanks!

 

 

Similar Threads

  1. Please help to fetch data to client
    By phancongphuoc in forum Adapter SDKs
    Replies: 1
    Last Post: December 16th, 2010, 07:57 AM
  2. Replies: 5
    Last Post: July 12th, 2010, 10:12 AM
  3. Client receive old data after some time.
    By mnenchev in forum General
    Replies: 3
    Last Post: November 25th, 2009, 02:27 PM
  4. Web client not receiving any data?
    By TonyRoberts in forum Client SDKs
    Replies: 10
    Last Post: October 10th, 2007, 09:00 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 03:41 AM.