How to communicate over the internet between apps

Hi, I need to send some simple strings over the internet to and from an android app that will run on several devices to and from a single server app.

I think I should use a simple tcp server and client with something like noip to generate a static ip for my server app, but I am not sure. I want it to be as fast as possible and have some way of managing the connection. I dont need to store anything, just send a remote signal now and then and get confirmation that it was received.

The android apps (also made with OF) will be connected over a 3g connection that is usually very reliable in the area it will be used but not 100%.

If anyone has a good suggestion let me know.

Fred

Hi @fresla,

How often is “now and then”? Would http requests do the trick?

P.

@pelayo It is for a show that will go for an hour, 6 times in the show I need to communicate with the phones (there is 20 of them).

I don’t think http requests would do as I want to be able to trigger different events from the server (well the laptop I am sitting in front of) and make things happen on the phones- a get request would mean that the phones need to know when to do the get and I dont want the users to do anything. But truth be told networking outside of osc and simple file stuff is not something I have a lot of experience with- hence the vague request for advice.

Cheers

Is there a limitation of OSC that you are running into? That would be the easiest route.

I have had this scenario a few times but I solved it in different ways depending on the case. Without OSC and all the mobiles connected to the same network or http requests as an option I think next step is use sockets.

After reading the docs. Using ofxTCPServer / ofxTCPClient as you say sounds good to me for sending strings and using OF on the Android side. But never tried that specifically. Sorry.

Without OF on the phones side I did something similar to what you tell once with web sockets. OF on the server side and HTML5 client on the phones. I can say this worked for me using https://github.com/labatrockwell/ofxLibwebsockets

Sorry i can´t help you more.

@jvcleave I thought it would be unreliable over a 3g network, I guess I just have to program in some message confirmation? I am really at the beginning of this and wanted to ask some advice.

@pelayo Thanks, for the hints anyway. I will try implement OSC and TCP and see how it goes.

https://github.com/bakercp/ofxJSONRPC + https://github.com/bakercp/ofxHTTP (using websockets) might be useful.

Hi Fred,

yet another suggestion might be to use the WAMP-protocol (web application messaging), a websocket-subprotocol that combines RPC and PubSub patterns.
It has client and server implementations in many languages.

http://wamp.ws/

Roger

I checked out on wamp, which looks promising.However, https://github.com/tavendo/AutobahnCpp seems to only support the Client side of wamp. Neither Dealer or Broker are listed on the Application roles. Running a python server besides OF is possible, but…
I also stumbled across spacebrew, which does afaik the Publish/Subscribe part of wamp over websockets. Plus routing between applications. Check out Spacebrew
To get to freslas Question: I think that OSC would be the easiest and quickest way to handle this task.
Also: Is the Server Part connected over 3g? Where I come from the Mobile Providers do a lot of NATing so it’s hard to run services over the Mobile Network.

https://github.com/arturoc/ofxNice does NAT transversal, i’ve used it to transmit video, audio, osc… over RTP with ofxGstRTP + ofxXMPP to do session initiation, but you could adapt it to work for osc alone. you would also need to compile libnice for android

After some clever help we achieved this using nodejs. I used a free server called openshift and native sockets on android to communicate. It ended up far from of but was an elegant solution. When the project is done I’ll post the solution. As it looks like a normal web request there was no need for Nat transversal or anything really complicated. Unfortunately you have to go to java to do this and although it would work with ofxnodejs on desktop this will not work on android.