Using the Network module properly

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

Polgar Balazs
I ended up with implementing

I ended up with implementing a similar behaviour with periodic jQuery AJAX calls to the backend and combining the result with data from the Signal module.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments