A pointer to the Engine is received when your onEngineCreation callback is invoked by Lightstreamer library.
I see that the callback saves the pointer to $wnd.lsEngine;
this is the pointer you can use afterwards to invoke all methods targeted to the Engine,
like: $wnd.lsEngine.changeStatus("DISCONNECTED") to disconnect.
If you did that, it should have worked.

Note that the general way of managing the lifecycle of the Engine pointer is slightly different and has to be followed in case you have multiple pages sharing the Engine; it consists of:
  • implementing the onEngineReady callback and saving the pointer there (onEngineReady is similar to onEngineCreation, but it is invoked also when the page already finds an Engine and just shares it).
  • implementing the onEngineLost callback to just clear the pointer (in fact, if a different page holds the shared Engine and gets closed, the Engine may be temporarily unavailable to the other pages).


I didn't really mean that your init method had better be split.
In general, the PushPage and Engine initialization code is separated from the table creation and subscription code. After creating and configuring the PushPage object, you can save the pointer (as you do, in $wnd.page) and use it later when you generate the cells on the page and create the Table object.