I wish to create a Cordova/Android app that will be called/executed from my server. Both devices are on the same intranet and connect via WiFi, therefore no cloud messaging required . For another scenario I have done the opposite. i.e. Android calls, via Ajax, an application on a Raspberry Pi for door opening purposes but this time I want to call an Android application from a Raspberry Pi. Where do I start? Ajax? Socket Server? What is the recommended connection method?
1 Answer
I think that websockets are the way to go. Implementing such a real time application allows you to 'push' data from the server to connected clients.
This can be initiated by clients (like in a chat application) but also by the server based on whatever events.
Have a look at Primus as a possible implementation. It abstracts the functionality from the websockets layer. This way it is possible to work with different websocket implementations.
6 Comments
Straygrey
To make my story a little more complicated, after being called, I want the Android application to take a photograph and send that back to the server, then wait for next call. I thought Ajax might serve the purpose.
André Kreienbring
Thats perfectly possible with websockets. As soon as data arrives from the server it can be interpreted and reacted upon. Messages (e.g) as JSON objects) can be send back and forth.
Straygrey
I have created a websocket application but when I attempt to connect to it from another device I get "connection refused".
Straygrey
BTW My app is based on what I found at stackoverflow.com/questions/25464614/…
Straygrey
I have attempted doing something similar but I get "connection refused" when I attempt connecting from my server?
|