I'm trying to understand why Lightstreamer sends this as a first messages (I was expecting json or something similar but it seems javascript)
The response seems a kind of Javascript. The LS_window.LS_e function, for example, is native of Lightstreamer?
HTTP/1.1 200 OK
server: Lightstreamer-Server/7.1.1
content-type: text/javascript; charset=ISO-8859-1
cache-control: no-store
cache-control: no-transform
cache-control: no-cache
pragma: no-cache
access-control-allow-credentials: true
x-accel-buffering: no
var myEnv = lsc;
var phase = null;
function setPhase(ph) {
phase = ph;
}
function start(sID, addr, kaMs, reqLim, srv, ip) {
LS_window.LS_e(1, phase, sID, addr, kaMs, reqLim, srv, ip);
}
function loop(holdMs) {
LS_window.LS_e(2, phase, holdMs);
}
setPhase(2501);start('*****', null, 0, 150000, 'HTTP Server', '*****');loop(0);
The following data exchanged are native of Lighstreamer or is something specific to this app I'm monitoring?
bind_session
LS_session=*****&LS_phase=2503&LS_cause=loop1&LS_keepalive_millis=5000&LS_container=lsc&
var myEnv = lsc;
var phase = null;
function setPhase(ph) {
phase = ph;
}
var winPhase = {};
function setWin(tbl, ph) {
winPhase[tbl] = ph;
}
var clsd = false;
function c(cod, ph, tbl, its, flds, key, com) {
LS_window.LS_w(cod, ph, tbl, its, flds, key, com);
}
function error(cod, ph, tbl, msg) {
if (tbl != null) {
LS_window.LS_l(cod, ph, tbl, msg);
} else {
LS_window.LS_l(cod, phase, null, msg);
}
}
function start(sID, addr, kaMs, reqLim, srv, ip) {
LS_window.LS_e(1, phase, sID, addr, kaMs, reqLim, srv, ip);
}
function end(cause) {
LS_window.LS_e(4, phase, cause);
}
function loop(holdMs) {
LS_window.LS_e(2, phase, holdMs);
}
function retry() {
LS_window.LS_e(3, phase);
}
function s0() {}
function bw(maxBW) {
LS_window.LS_e(5, phase, maxBW);
}
function y(secs) {
LS_window.LS_s(phase, secs);
}
var unchangedSignal = {};
unchangedSignal.length = -1;
function convert(b, f) {
var a, c, d = f, e = [];
for(a = 0;a < b.length;a++) {
if(a < f) {
e[a] = b[a]
} else {
if(b[a].charAt) {
b[a] == '$' ? e[d] = '' : b[a] == '#' ? e[d] = null : (c = b[a].charAt(0), e[d] = c == '$' || c == '#' ? b[a].substring(1) : b[a]), d++
} else {
for(c = 0;c < b[a];c++) {
e[d] = unchangedSignal, d++
}
}
}
}
return e;
}
function d(tbl) {
try { LS_window.LS_u(winPhase[tbl], convert(arguments || d.arguments, 2)); } catch(exc) {}
}
function z(tbl) {
LS_window.LS_v(winPhase[tbl], convert(arguments || z.arguments, 2));
}
function n(tbl) {
LS_window.LS_n(winPhase[tbl], arguments || n.arguments);
}
function s(tbl) {
LS_window.LS_s(winPhase[tbl], arguments || s.arguments);
}
function r(tbl) {
LS_window.LS_o(winPhase[tbl], arguments || r.arguments);
}
function p() {
LS_window.LS_u(phase, arguments || p.arguments);
}
myEnv.setPhase = setPhase;
myEnv.setWin = setWin;
myEnv.c = c;
myEnv.error = error;
myEnv.end = end;
myEnv.start = start;
myEnv.loop = loop;
myEnv.retry = retry;
myEnv.s0 = s0;
myEnv.bw = bw;
myEnv.y = y;
myEnv.convert = convert;
myEnv.d = d;
myEnv.z = z;
myEnv.n = n;
myEnv.s = s;
myEnv.r = r;
myEnv.p = p;
myEnv.LS_window = LS_window;
// END OF HEADER
setPhase(2503);
start('*******', null, 10000, 150000);
bw(0.0);
The exchange you see is Lightstreamer protocol and only some values are determined by the app.
This protocol is based on javascript and it is used by old client libraries; for instance, the LS_e function is provided by the client library.
There are several protocols available to the clients; one of them, TLCP, based on pure text, is public and documented here.