The preferred way to access the
LightstreamerEngineobject from a Push-page is through the
onEngineReady() event handler callback of the PushPage object. You will be passed a reference to the LightstreamerEngine object (that you can save for subsequent uses) as soon as it is ready. A typical implementation could be the following:
[highlight=javascript]
var e; //LightstreamerEngine object reference
var p = new PushPage();
p.onEngineReady = function(engine) { e = engine }
p.bind();
// one on the possible ways of setting the engine
p.loadEngine(“lsengine.html?config=lsengine_config.js”);
// first alternative way
// p.loadEngineMinimal(“lsengine.html”, “MyEngine”);
// second alternative way
// p.setEngineReference(parent.frames[“MY_ENGINE_FRAME”]);
// third alternative way
// p.setEngineReference(null, “MyEngine”);
The result is that the variable “e” of the Push-page will contain a reference to the LightstreamerEngine object only when the engine is actually ready.