Hi,
I turned my LS server down, and tried to run my app, with possible registration to all the events i could expect. Well, nothings happening, the client waits for some min's and silently dies down. How can I get the info that my server is not running? The status change is getting invoked, and it is displaying
DISCONNECTED => CONNECTING
After this, nothing happening. The code is below. Please help me out.
private function connectToLs(connector:LSConnector):void{
lsClient = new LSClient();
lsClient.addEventListener(StatusChangeEvent.STATUS_CHANGE,onLSStatusChange);
lsClient.addEventListener(SubscriptionEvent.SUBSCRIPTION,onLSSubscription);
lsClient.addEventListener(ServerErrorEvent.SERVER_ERROR,onLSConnectionError);
lsClient.addEventListener(ControlErrorEvent.CONTROL_ERROR,onLSConnectionError);
lsClient.addEventListener(ControlConnectionErrorEvent.CONTROL_CONNECTION_ERROR,onLSConnectionError);
var connectionInfo:ConnectionInfo = new ConnectionInfo();
connectionInfo.setServer(connector.host);
connectionInfo.setAdapter(connector.mainAdapter);
connectionInfo.setControlPort(connector.port);
connectionInfo.setPort(connector.port);
connectionInfo.setControlProtocol(connector.protocol);
connectionInfo.setProtocol(connector.protocol);
var connectionPolicy:ConnectionPolicy = new ConnectionPolicy();
//Tried default nthing happ, so added these lines (These are the default values)
connectionPolicy.setTimeoutForStalled(2000);
connectionPolicy.setTimeoutForReconnect(15000);
connectionPolicy.setRetryTimeout(5000);
//Connect to Lightstreamer Server
try {
lsClient.openConnection(connectionInfo,connectionPolicy);
} catch(e:Error) {
Alert.show(e.message);//No alert also!!
}
}
public function onLSStatusChange(event:StatusChangeEvent):void{
trace(event.previousStatus + " => " + event.status);
}