Vinoth Kumar
Vinoth Kumar

Reputation: 499

Has ionic a limited connection pool that once exhausted does not allow new connections?

I'm having an issue with my ionic1 application using Lightstreamer. I tried to connect LS server to my 4 pages. So I tried to connect with global connection declaration and used in an individual controller with new connection and connection sharing. It worked in a browser when I test. But didn't work when I check in the real device. In my index.html file

<script>
    var protocolToUse = document.location.protocol != "file:" ? document.location.protocol : "http:";
        var portToUse = document.location.protocol == "https:" ? "443" : "8080";
        var lsClient = new Lightstreamer.LightstreamerClient(protocolToUse+"//domain.com:"+portToUse,"STOCKLIST_REMOTE");
        lsClient.enableSharing(new Lightstreamer.ConnectionSharing("MYCommonConnection", "ATTACH", "CREATE"));
        lsClient.connect();
</script>

And in my all 4 controllers, I have added the code as like below

var protocolToUse = document.location.protocol != "file:" ? document.location.protocol : "http:";
var portToUse = document.location.protocol == "https:" ? "443" : "8080";
var lsClient = new Lightstreamer.LightstreamerClient(protocolToUse+"//domain.com:"+portToUse,"STOCKLIST_REMOTE");
lsClient.enableSharing(new Lightstreamer.ConnectionSharing("MYCommonConnection", "ATTACH", "CREATE"));
lsClient.addListener({
    onStatusChange: function(newStatus) {
      //update the connection status on the UI
     console.log(newStatus);
     if(newStatus == "CONNECTED:HTTP-STREAMING"){
        $scope.checkinternet    = false;
     }else if(newStatus == 'DISCONNECTED:WILL-RETRY'){
         $scope.checkinternet   = true;
     }
    }
  });

This code worked well in my browser without connection and session termination. But didn't worked in device. I have tried as like below after got some suggestion from LS server persons,

 var lsClient = new Lightstreamer.LightstreamerClient(protocolToUse+"//domain.com:"+portToUse,"STOCKLIST_REMOTE");
    lsClient.connect();

and lsClient.disconnect() for every navigation. But if I navigate pages 3 times menas connection getting teriminate and connection status showing like DISCONNECTED:WILL-RETRY. For this I asked help with LS server support tems they are saying ionic may have limited connection pool. Is there anything connection limitation in ionic, can I need to override the connection limitation in ionic. Can any one please help me to solve this issue?

Upvotes: 1

Views: 44

Answers (0)

Related Questions