Registry / http-networking / lightstreamer-client-web

lightstreamer-client-web

JSON →
library9.2.3jsnpmunverified

Lightstreamer Client Web SDK (v9.2.3, stable) enables real-time bidirectional communication with a Lightstreamer server from web browsers. It supports WebSocket fallback options and delivers streaming data updates with low latency. Key differentiators: multiple module formats (UMD, CommonJS, ES Module) for varying bundler compatibility; includes core, full, and MPN builds; provides TypeScript definitions. Maintained by Lightstreamer with frequent releases. Ideal for financial tickers, live dashboards, and collaborative applications.

npm install lightstreamer-client-web
INSTALL
IMPORT
SIG · LIGHTSTREAMER-CLIE
L
lightstreamer-client-web
http-networkingjavascriptv9.2.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LightstreamerClient
import { LightstreamerClient } from 'lightstreamer-client-web';
const LightstreamerClient = require('lightstreamer-client-web');
ESM import for modern bundlers; requires using the ES module build.
Subscription
import { Subscription } from 'lightstreamer-client-web';
import Subscription from 'lightstreamer-client-web';
Subscription is a named export, not default.
ConsoleLogger
import { ConsoleLogger } from 'lightstreamer-client-web';
import { ConsoleLogger } from 'lightstreamer-client-web/lightstreamer.esm.js';
Import from the package root; bundlers resolve the correct file.

Connects to Lightstreamer demo server, subscribes to three items with MERGE mode, and logs stock updates to console.

import { LightstreamerClient, Subscription } from 'lightstreamer-client-web'; import { ConsoleLogger } from 'lightstreamer-client-web'; const client = new LightstreamerClient('http://push.lightstreamer.com', 'DEMO'); client.addListener({ onListenEnd: () => console.log('Disconnected'), onServerError: (errorCode, errorMessage) => console.error(errorCode, errorMessage), onStatusChange: (newStatus) => console.log('Status:', newStatus) }); const sub = new Subscription('MERGE', ['item1','item2','item3'], ['stock_name','last_price']); sub.setDataAdapter('QUOTE_ADAPTER'); sub.setRequestedSnapshot('yes'); sub.addListener({ onItemUpdate: (obj) => { console.log(obj.getValue('stock_name') + ': ' + obj.getValue('last_price')); }, onSubscriptionError: (code, msg) => console.error('Subscription error', code, msg) }); client.connect(); client.subscribe(sub);
Debug
Known issues
gotchaWhen using the UMD build with a script tag, the library is placed under the namespace specified by the data-lightstreamer-ns attribute. If omitted, it pollutes the global window object.
fix
Add data-lightstreamer-ns='Ls' to the script tag to create a global Ls object, or omit to inject directly into window.
affects: >=9.0
gotchaThe full library contains Widgets and Mobile Push Notifications modules which are not available in Web Workers. Using the full build in a worker throws errors.
fix
Use the core build instead (e.g., importScripts('path/to/lightstreamer-core.js')).
affects: >=9.0
gotchaCommonJS and ES Module builds are not minified; bundlers are expected to handle minification. Attempting to use them directly in a browser without bundling will fail.
fix
Use the UMD minified build for direct browser usage, or configure your bundler to minify the output.
affects: >=9.0
deprecatedThe 'Subscription' constructor signature with mode, items, fields is still supported but the recommended pattern is to use the options object.
fix
Use new Subscription({mode:'MERGE', items:['item1'], fields:['field1']}) instead of positional arguments.
affects: >=9.0
Errors
Common errors & fixes
Uncaught ReferenceError: Ls is not defined
The UMD script tag is missing the data-lightstreamer-ns attribute, but code references Ls.LightstreamerClient.
fix
Add data-lightstreamer-ns='Ls' to the script tag, or change code to use window.LightstreamerClient directly.
Cannot use 'import' statement outside a module
The library's ES module build is loaded via a script tag without type='module' or in a non-module context.
fix
Use the UMD build with a script tag, or add type='module' to the script tag and use an importmap or bundler.
Error: No client found for session
Calling subscribe before connect() or after disconnect() without a valid session.
fix
Ensure you call client.connect() before client.subscribe(sub), and check client status via client.addListener({onStatusChange}).
Upgrade
Version history
9.2.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lightstreamer-client-web — npm install lightstreamer-client-web · libregistry