Lightstreamer JavaScript Client 6.1.4 API

´╗┐This JavaScript library allows any JavaScript application to request and display pushed data from Lightstreamer Server. The library can be used with two different approaches: leveraging an AMD loader or in the old fashioned way through global variables. The library is distributed in its complete form in the AMD-oriented format. It is recommended to load the generator.html file distributed with the library to prepare a custom library that contains only the needed bits and in the format of choice. The generator will also show how and which files to include and how to reference the included classes. An online version of the generator can be found here: Generator.

Start digging into the API from the LightstreamerClient object.

When running in a browser window some limitation may apply:
  • On the current version of Opera and on older versions of other browsers (IE<=7, FX<=3) both Ligthtstreamer server and the Web Server which supplies the front-end pages must share a common domain for the streaming to work; so, as an example, if the web server is www.mycompany.com and the Lightstreamer server is push.mycompany.com the following code is needed:
    document.domain="mycompany.com";
    Note that, as a consequence, you may need to set the document.domain in other front-end pages too, in order to allow them to interoperate with pages that have their document.domain set.
    Further details and special cases can be found in the "Additional notes" section of the "Lightstreamer JS Client - Deployment Config Matrix" document.
  • On the current version of Opera and on older versions of other browsers (IE<=7, FX<=2) if an HTML "A" element is used to run javascript code, then the href="javascript:myStuff()" syntax should not be used, as it may cause the streaming connection to be stopped. The href="#" onClick="myStuff(); return false;" syntax should be used, instead.
    Note the final "return false;" statement, which prevents the execution of the default event handler. If missing, the browser may change the displayed address by adding "/#"; some browsers (e.g. Firefox) may even add a spurious entry in the history list.
    Anyway remember that you can also associate onclick events to elements other than "A" avoiding the problem altogether.
  • Some browsers are permitted to open a limited number of concurrent HTTP connections per server. If the front-end is composed by different html pages (or one single html page using different LightstreamerClient instances), each one with the need to get data from the same Lightstreamer server, you may want them to share the same connection to avoid saturating the connection pool. You can leverage the connectionSharing property of your LightstreamerClient instance to make various LightstreamerClient share the connection.
  • On IE6 if a page contains a LightstreamerClient instance, then it cannot be used as a link target or referred to in a "window.open" command, because, even in case the link is meant to preserve the page (i.e. to access it without replacing it, as in "myPage.html#position") this may stop the streaming connection.
  • Other common issues can find a solution on our public forum.

The library can also be used inside a Web Worker (excluding on Opera) and inside a Node.js instance.
The library generator highlights which class can or can't be used on such environments.
Check out the related example and associated README to learn more.