1 Reply Latest reply on Jun 14, 2017 6:21 AM by Polgar Balazs

    Using the Network module properly

    Polgar Balazs

      Hi everyone,

       

      I'm relatively new to SB1 development and I'm currently working on an SB1 application which can remain functional without a Wi-Fi connection and save its data into a local web database. I'm trying to base the synchronization between the local database and the backend on the RhoElements 2 Network Module as suggested in the Programmer's Guide. I'm following the RhoElements documentation:

      http://docs.rhomobile.com/en/2.2.0/rhoelements/network/

       

      Here are the relevant code snippets:

      function initNetwork(){

          network.networkEvent = 'networkEvent(%json)';

          network.host = '192.168.1.100';

          network.port = '8085';

          network.start();

      }

       

      asl.events.subscribe("onloaded", function() {

           //...

           initNetwork();

      })

       

      function networkEvent(jsonObject){

           var connectInfo = jsonObject.connectionInformation;

           generic.Log('Connection Info: ' + connectInfo, 1)

      }

       

      But for some reason my app does not receive any callbacks from the network module at all. And also there is no sign of any related messages in the device log. Could you please help me with this issue? I'm not sure in which direction should I continue my code inspection.

       

      Regards,

      Balazs Polgar