Results 1 to 4 of 4

Hybrid View

  1. #1
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121

    LS Connection getting disconnect often

    I'm using LS client in ionic 1 application. I have developed the mobile application using ionic 1. I have initialized the LS connection in every controller. Totally I have 3 tabs and whenever navigate to tabs every time connection getting initialize and If I navigate over the tabs more than 3 times my LS status object showing like disconnected and connection. Showing these 2 status continuously. I have the below code
    Code:
    	$scope.setupLightstreamer = function() {
    		var protocolToUse = document.location.protocol != "file:" ? document.location.protocol : "http:";
    		var portToUse = document.location.protocol == "https:" ? "443" : "8080";
    		var lsClient = new Lightstreamer.LightstreamerClient(protocolToUse+"//myhost:"+portToUse,"MVBSTOCKLIST_REMOTE");	
    		
    		lsClient.addListener({
    			onStatusChange: function(newStatus) {
    			console.log(newStatus);
    			}
    		});
          	lsClient.connect();
    	}
    So every time I click on tabs and navigate this code getting execute and creating new instance. So many connection lives on this and getting issue it seems.
    And also I have tried like creating single instance from service and checking whether instance available in controller , if else will create new instance else using old instance itself. But update not happening if I navigate over the tabs more than 3 times. could you please help anyone to solve this issue.

  2. #2
    Hi rvkvino,

    The problem you have is very similar to the problem reported in this thread, where we asked you to collect both client and server logs highlighting the issue.

    Can you now provide us the requested logs?
    Without them it is very hard for us to understand the root cause of the malfunction you experienced.

    To collect the log on the client side, you just need the following statements at the beginning of your application:

    var log = new SimpleLoggerProvider();
    log.addLoggerAppender(new ConsoleAppender("DEBUG", "*"));
    LightstreamerClient.setLoggerProvider(log);

  3. #3
    Power Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    121
    Hi,
    I had tried this by adding SimpleLoggerProvider from https://lightstreamer.com/docs/clien...generator.html, but showing the error like ERROR: ReferenceError: SimpleLoggerProvider is not defined

  4. #4
    Hi,

    You should also include the classes ConsoleAppender and LogMessages.
    For example, if you use AMD, the complete code is:

    require(["LightstreamerClient", "SimpleLoggerProvider", "ConsoleAppender", "LogMessages" /* other dependencies */],
    function(LightstreamerClient, SimpleLoggerProvider,ConsoleAppender,LogMessages) {
    /* set up logger */
    var log = new SimpleLoggerProvider();
    log.addLoggerAppender(new ConsoleAppender("DEBUG", "*"));
    LightstreamerClient.setLoggerProvider(log);

    /* create the client and connect */
    });

    Additional info about the use of the client are in the Web client guide.
    Last edited by Alessandro Carioni; May 15th, 2018 at 09:01 AM.

 

 

Similar Threads

  1. connection to LS disconnect much
    By engcoder in forum Adapter SDKs
    Replies: 3
    Last Post: October 16th, 2014, 10:24 AM
  2. Replies: 11
    Last Post: January 9th, 2013, 10:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 07:19 PM.