Results 1 to 5 of 5

Hybrid View

  1. #1
    Senior Member
    Join Date
    Nov 2006
    Location
    Riyadh
    Posts
    33
    Thanks Alex for you prompt answer.

    Can Option 2 be used to push COMMAND messages to specific users ?
    In the sample you provided (portfolio), all users share the same group item.
    In my case, when a user requests to add/remove an item from a group (List.1), only him should be impacted. But it seems to me COMMAND is global, right ?

    Regards

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

    You're right, the COMMAND message and in general all updates are sent to all the clients subscribed to the specific item.

    Note that you can - starting from a common name client-side - modify users subscriptions server-side:
    In the MetadataProvider interface there is a method called getItems. You can implement it to customize the items to be subscribed per each user.

    Hope that helps,
    Goodbye.

    PS: you can also implement the customizeUpdate method to customize each update on an user basis. Btw take count of the advices of the JavaDocs.

  3. #3
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521

    Lightbulb

    To answer your question from a more general point of view, yes, you can certainly push different commands to different clients. To do this you will either use a different group descriptor for each user or the same group descriptor with the Metadata Adapter expanding it to different items names based on the user identity (see the explanation below). Remember that In COMMAND mode an item defines a whole table (e.g. a set of stocks). This means that if different users must see different table rows, then they should subscribe to different items.

    Example.
    Let's imagine a typical Portoflio subscribed in COMMAND mode. Here are the relevant steps:
    1. [Client] The LightstreamerEngine is created, and the user's credentials are provided through:
      Code javascript:
      1. connection.setUserName(“alex”);
      2. connection.setPassword(“mypassword”);
    2. [Client] You add a Portfolio table template to your page and perform a corresponding subscription in COMMAND mode through an addTable(). The Table constructor will be for example:
      Code javascript:
      1. new DynaMetapushTable("portfolio", "key command stock price qty cval time", "COMMAND")
      This means that the group descriptor is “portfolio”. See DynaMetaPushTable.
    3. [Server] The Metadata Adapter receives this method call:
      Code java:
      1. getItems(“alex”, “portfolio”)
      and it responds with:
      {“alex-portfolio”}
    4. [Server] The Data Adapter receives this method call:
      Code java:
      1. subscribe(“alex-portfolio”, false)
      At this point the Data Adapter queries a DB to retrieve the current content of Alex’s portfolio, getting a list of stocks, quantities, etc.
      The Data Adapter subscribes to any stocks of that list that it is not already subscribed to.
      The Data Adapter subscribes to a topic that delivers any changes in the portfolio content for Alex.
      The Data Adapter delivers the snapshot of Alex’s portfolio (comprised of a series of “ADD” commands).
    5. [Server] Each time the Data Adapter receives an event from the stock-quote feed or from the portfolio-content feed, it consults its internal tables and delivers a command to the client, that can be “ADD”, “UPDATE” or “DELETE”.

 

 

Similar Threads

  1. Adding or Removing Subscriptions
    By subuta in forum Client SDKs
    Replies: 4
    Last Post: December 27th, 2011, 03:03 PM
  2. Replies: 2
    Last Post: December 24th, 2010, 07:51 AM
  3. Adding/Removing items dynamically
    By Otake in forum Client SDKs
    Replies: 5
    Last Post: December 17th, 2009, 02:15 PM
  4. IG Group's cool applications
    By Alessandro in forum General
    Replies: 6
    Last Post: July 1st, 2008, 02:26 PM
  5. Changing subscribed topic
    By simonef in forum Client SDKs
    Replies: 1
    Last Post: June 10th, 2008, 01:47 PM

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 04:39 PM.