Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    May 2008
    Location
    DC
    Posts
    2

    Passing data from the adapter to the client as an object

    Hi All,

    I’m slowly making progress using lightstreamer but I have only been able to pass data from the adapter to the client in the form of a string.
    For ex:
    Code:
    ...
    //somewhere in the DataAdapter
    Map jmsData = (Map)objectMessage.getObject(); //get a Map from a JMS queue. 
    
    //SomeObject is some complex Object 
    SomeObject data = jmsData.get(“data”);
    
    Map sendToClient = new HashMap();
    sendToClient.put(“name”, data.getName());
    sentToClient.put(“age”, Integer.toStrign(data.getAge());
    
    itemEventListener.smartUpdate(itemHandle, sendToClient, false);
    …
    Is there a way to pass a representation of SomeObject to the client maybe using JSON, or am I limited to just Strings?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    Lightstreamer requires that data is split into distinct fields, so that the Server can easily distinguish changing fields, to be transmitted, from unchanged fields, not to be transmitted.
    If your objects have a complex structure and you can't represent them as a collection of fields, then you can sacrifice transmission efficiency and serialize your objects in whichever way into a single String field. However, deserialization must be performed by custom code on the client side (JSON helps this very much).
    This can be done by using a NonVisualTable and implementing the "onItemUpdate" event handler so as to get the data, deserialize it and manage any display actions (and indeed I suppose that, with complex objects, our support for VisualTables made up of push cells would also not be useful).

  3. #3
    Member
    Join Date
    May 2008
    Location
    DC
    Posts
    2
    Thanks for the info. I didn't realize that there was a check to see if the fields needed to be updated. I just wanted to verify that the server makes the check. If a change isn't found, the info doesn't get sent by lightstreamer. If that's the case, it might not be worth sending a string representation of the object. i can just break my the objects down into Strings in the Data Adapter.

  4. #4
    Member
    Join Date
    Nov 2010
    Location
    HCMC
    Posts
    1

    OTE=eweinberg]Thanks for the info. I didn

    [QUOTE=eweinberg]Thanks for the info. I didn't realize that there was a check to see if the fields needed to be updated. I just wanted to verify that the server makes the check. If a change isn't found, the info doesn't

 

 

Similar Threads

  1. Replies: 4
    Last Post: October 24th, 2011, 10:33 AM
  2. Replies: 1
    Last Post: June 23rd, 2011, 11:10 AM
  3. Get data specific to each User by passing parameters
    By leonardodar in forum Adapter SDKs
    Replies: 3
    Last Post: March 16th, 2011, 10:45 AM
  4. LightStreamer with AMF object support
    By sachinpatel2 in forum Client SDKs
    Replies: 1
    Last Post: September 10th, 2010, 11:01 AM
  5. Replies: 1
    Last Post: May 21st, 2009, 10:41 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 09:50 AM.