In my case, user need not to get updates all the time; when ever he stops receiving real time data, i wanna stop the connection and should restart it whenever he wants.
i use following to remove a table, when he presses the stop button.
if (lsPage.getTable(tableId)) lsPage.removeTable(tableId);
lsPage = null;
when he press restart i call following,
lsPage = new PushPage();
lsPage.onEngineCreation = function(engine) {
engine.connection.setLSHost("mydomain/push");
engine.connection.setLSPort(null);
engine.connection.setAdapterName("MyAdapter");
engine.changeStatus("STREAMING");
};
lsPage.bind();
lsPage.createEngine("MyEngine", "../ls");
//lsPage.addTable(////);
when i do it, it throws an exception(client side) stating that
"createEngine() has already been called";
If i dont recreate the engine this doesnt happen obviously.
my original requirement is to keep the connection only when he requires it.
is there any way to totally disconnect from the server when he doesnt need it. ( even i set lsPage as null, it tries to keep the connection. [for example it shows in firebug "GET STREAMING IN PROGRESS" when i stop the lightstreamer server]) Could you please assist me in this, so that i can stop/start connection when it is required?
will it be able to do it by changing the status to disconnected, when he stops? if so, could you please give me some code snippet to stop the server, coz i'm struggling to do it for a long time?