Results 1 to 10 of 10

Hybrid View

  1. #1
    Senior Member
    Join Date
    Jul 2009
    Location
    not
    Posts
    41
    I already got that. In fact, i didin't modify that code at all. I used it as it is:
    Code:
        public void subscribe(String itemName, boolean needsIterator)
                throws SubscriptionException {
            if (needsIterator) {
            }
            if (itemName.startsWith("item")) {
                synchronized (subscribedItems) {
                    subscribedItems.put(itemName, new Boolean(false));
                }
                myFeed.sendCurrentValues(itemName);
            } else {
                throw new SubscriptionException("Unexpected item: " + itemName);
            }
        }
    I'm still debugging...I will keep you informed

  2. #2
    Senior Member
    Join Date
    Jul 2009
    Location
    not
    Posts
    41
    As i said before, the data are being added to the stockGenerators variable (it takes some times), so when the subscribe function is called, it will not send anything to Lightstreamer server (because that item is not found "yet" in stockGenerators variable), so myFeed.sendCurrentValues(itemName); will return nothing. That's why data will not be shown in the browser.
    I think it will be shown only when you refresh the session (after you close the browser, and wait a while).
    Is there a solution to call the subscribe function when you refresh the page ? Or is there a way when you close the browser or page, you kill the session ( so i don't have to wait some time before the session get killed) ?

  3. #3
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Is there a solution to call the subscribe function when you refresh the page?
    No, there isn't, the subscribe method for a certain item on the data adapter is called when such item is subscribed by a client for the first time while the unsubscribe call for the same item is called when the last client subscribed to that item closes its session (or explicitly unsubscribes from the item).
    eg: admitting a just started server, if a clients subscribes to itemX then subscribe for itemX is called on the adapter, but if a second client subscribes to itemX too the subscribe method is not called again. After that, even if the first client closes its session, the unsubscribe for itemX is not called because the second client is still subscribed.

    So you can't govern the subscribe/unsubscribe call through a client as other clients may interferer.

    The solution to your issue would be to track the subscribed items so that when stockGenerators is filled for the first time, if an item is already subscribed, you will be able to send the updates to the server as soon as them are available, so that the server in turn will send them to the connected clients.

    HTH

  4. #4
    Senior Member
    Join Date
    Jul 2009
    Location
    not
    Posts
    41
    Thank you very much Mone

 

 

Similar Threads

  1. LS Flex Client is stalled on restart of LS server
    By pratik in forum Client SDKs
    Replies: 4
    Last Post: June 26th, 2015, 08:56 AM
  2. Replies: 6
    Last Post: December 7th, 2010, 09:26 AM
  3. Replies: 1
    Last Post: January 18th, 2010, 03:27 PM
  4. Replies: 3
    Last Post: September 29th, 2009, 08:54 AM
  5. Updates dropped when restart is performed
    By ctranfd in forum Client SDKs
    Replies: 3
    Last Post: June 5th, 2009, 11:45 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 10:35 PM.