Lightstreamer 新手:我应该如何解释这个 Web 请求?
Posted
技术标签:
【中文标题】Lightstreamer 新手:我应该如何解释这个 Web 请求?【英文标题】:New to Lightstreamer: how should I interpret this web request? 【发布时间】:2021-05-30 03:19:19 【问题描述】:我试图理解为什么 Lightstreamer 会将此作为第一条消息发送(我期待 json 或类似的东西,但它似乎是 javascript)
请求:
响应似乎是一种 Javascript。比如 LS_window.LS_e 函数是 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);
以下交换的数据是 Lightstreamer 的原生数据,还是我正在监控的这个应用程序特有的数据?
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);
【问题讨论】:
【参考方案1】:您看到的交换是 Lightstreamer 协议,只有一些值是由应用程序确定的。
此协议基于 javascript,由旧客户端库使用;例如,LS_e 函数由客户端库提供。
客户端可以使用多种协议;其中之一,基于纯文本的 TLCP,是公开的并记录在案的here。
【讨论】:
以上是关于Lightstreamer 新手:我应该如何解释这个 Web 请求?的主要内容,如果未能解决你的问题,请参考以下文章