Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    May 2010
    Location
    London
    Posts
    18

    Monitoring multiple LS clients

    Hi,

    I have a requirement whereby I need to determine which of our 2 LS servers is the quickest for a client, and subscribe to it accordingly. This is so that, at a very basic level, our Asian clients get data from our Asian server, and our EMEA clients from our EMEA server.

    In theory, I want to poll each LS server from the client using AJAX for a set time period, take an average, and save the quickest result. However, as our site is hosted on www.example.com, and our LS servers are at push.example.com and push-hk.example.com, and AJAX does not allow cross subdomain requests, I have found myself looking at implementing a dynamic iFrame solution.

    From looking at the Lightstreamer JS code, it looks like you've had to think about this problem too (LS_AJAXFRAME, ajax_frame.html, etc.), however the JS code is obfuscated and not very easy to read.

    Could you suggest an easy way for me to poll the LS servers using your AJAX iFrame JS code please? Or if you've come across this scenario before and have any better suggestions that'd be great.

    Thanks,
    Colm

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

    yes, the ajax frame is exactly needed to make XHR requests to the push server.
    the problem in using the ajax frame for your case is that such file has to be downloaded from the server it will connect to, so after you've already chosen to which server to connect.
    You can take a look to the ajax_frame.html file source, it's pretty simple and is not obfuscated (excluding calls to parent.LS* methods, but there are only three of those, LS_a is called to notify that the page is ready, LS_x is called on XHR errors and LS_h on onreadystatuschange events).
    In any case if you're going to use the html approach you'll need to download two files, one per server
    Unfortunately that is currently the only way to make a XHR request to the server. In the next release we're going to include support for cross-origin requests but that will not work on old browses anyway and will require extra code on modern IEs.

    Another approach may be to deploy a js file like

    in the Lightstreamer internal web server (see <web_server> in the server configuration) and then download it through <script> inclusion



    Finally don't forget to keep into consideration the browser cache.

    HTH

 

 

Similar Threads

  1. multiple clients - filtered messaging
    By howard in forum Adapter APIs
    Replies: 2
    Last Post: December 1st, 2010, 05:33 PM
  2. JMX monitoring
    By churrusco in forum General
    Replies: 4
    Last Post: September 21st, 2009, 10:42 AM
  3. General Monitoring
    By silvamayne in forum General
    Replies: 1
    Last Post: October 8th, 2007, 05:27 PM
  4. Monitoring the Server through JConsole (before 4.0)
    By DarioCrivelli in forum General
    Replies: 2
    Last Post: August 21st, 2007, 01:16 PM
  5. JMX support for more detailed monitoring ?
    By rsouissi in forum General
    Replies: 1
    Last Post: May 30th, 2007, 04:15 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 07:18 AM.