1. #1
    Sencha User
    Join Date
    Apr 2012
    Location
    Linz, AT
    Posts
    31
    Answers
    1
    Vote Rating
    1
    drindal is on a distinguished road

      1  

    Default Answered: Sencha IO and Android (with or without phonegap) - WebSocketTransport - BUG

    Answered: Sencha IO and Android (with or without phonegap) - WebSocketTransport - BUG


    Hi everyone!

    I've built a st 2.2.1 app with the latest sencha io. I'm using the syncstorage proxy. When I'm working on the desktop pc, the app works fine. I'm able to login to the sencha cloud and i can sync my data with the cloud.

    When I try the same thing at an android browser the login screen is not showing. Either its hanging at the welcome screen or a dialog shows up with "Choose login type", which comes from the io sdk.

    The same problem occurs when i try to wrap my app with phonegap.

    The following error message occurs in the JS console or in the eclipse console:

    Code:
    Uncaught TypeError: Cannot call method 'start' of null
    This error occurs in Ext.cf.messaging.transports.AutoTransport line 88 because a socketTransport can not be established.

    When looking at the sourcecode I discovered that at android devices ths method Ext.cf.messaging.transports.WebSocketTransport.isSupported() returns false.

    The line 88
    Code:
     this.socketTransport.start();
    should be in the if branch of the WebSocketTransport.isSupported() query.Putting it there, fixes the app in android

    I think this is a bug!

    Working code fragment:
    Code:
    if(!this.socketTransport){            console.log(Ext.cf.messaging.transports.WebSocketTransport.isSupported());
                if(Ext.cf.messaging.transports.WebSocketTransport.isSupported()) {
                    
                    this.socketTransport = Ext.create(this.transportClasses["websocket"], this.config);
                    this.relayEvents(this.socketTransport, ["receive", "forbidden", "connected", "offline"]);
                    
                    this.socketTransport.on({connected: {fn: this.onSocketActive, scope: this}});                  
                    
                    this.socketTransport.start();           //here is the correct place                             
                } else {
                    Ext.cf.util.Logger.debug("AutoTransport: websockets not supported, XHR polling only");
                }
                
            }
            //this.socketTransport.start();          removed here, because socketTransport is not always initialized
            
            return true;
    Sencha IO Dev Team, please look into this.

    Thanks.

  2. Thank you for finding this we will get it fixed.

  3. #2
    Sencha User bruijn88's Avatar
    Join Date
    May 2008
    Posts
    66
    Answers
    1
    Vote Rating
    2
    bruijn88 is on a distinguished road

      0  

    Default


    just ran into the same problem, solved it the same way, so +1

  4. #3
    Sencha - IO Dev Team
    Join Date
    Apr 2011
    Posts
    86
    Answers
    28
    Vote Rating
    5
    jason.cline is on a distinguished road

      0  

    Default


    Thank you for finding this we will get it fixed.

Thread Participants: 2