As we have seen that RhoSync is a separate application hosted on some servers and the Rhodes application is a different one installed on the mobile client. Rhodes and RhoSync applications will interact with each other using the https
protocol. RhoSync application runs on port 9292 unless specified.
Open rhoconfig.txt
in your Rhodes application and add specify the URL for the RhoSync server:
syncserver = 'http://localhost:9292/application'
Note
If you are developing your app for Android then you have to give the IP address instead of localhost
. This is because Android simulator does not understand localhost
.
Now, when you create a build for the phone, it will connect to your server.
To enable sync for your model, go to model employee.rb
and company.rb
and add:
enable :sync class Employee include Rhom::PropertyBag belongs_to :company_id, 'Company' # Uncomment the following line to enable sync with Employee. enable :sync ...