Processing.js to Arduino Yun - how to make them talk over internet

Hi there.

I'm getting familiar to Arduino Yun and many internet based services, but one thing makes me feel puzzled.

I have a led matrix connected to Arduino Yun fully working. It shows icons getting the information in this format:

  byte parasol[8]={B00000100,B00000110,B00000110,B01111111,B10000111,B01000110,B00000110,B00000100};

or this

  byte sun[8]={0x14,0x14,0xfc,0x27,0xe4,0x3f,0x28,0x28};

than on the other side i want to use Processing.js to create a simple interface to create 8x8 images by touching on dots, and than sending this information to Arduino. This script will be on my online server.

What to choose to make them talk to each other?
Rest Api - this is to my knowladge only local (due to firewall), and has no ability to set port listening to anything different than the default ones.

Temboo - great service, but than I would need the script to be posting to some service (eg. Dropbox) and than make the temboo to read this text file.

BTW - checked the spacebrew and this looks great but only the public thing. There is a possibility to make a private server of this kind, but ... this has to be an overkill, true?

I strongly feel I'm trying to reinvent the wheel here.

I should also say that my internet provider forwarded for me ports in a range 4000-4005 and my router doesn't allow me to translate ports, so (I think) I'm stuck to services on the side of Yun that are either inteligent as Temboo or allow to specify the port they work on.

What is the simplest way to make a processing.js script located on an online hosting server, talk to the Arduino Yun in my home? Thank you for any clues.

Why cannot you forward ports to the Yun? Your script can talk directly to yun without the need of teembo.

My router (consumer grade) is not supporting port translation. The only ports i could operate would be 4000-4005 and these are not default ports on Yun to any web service. I tried to check is it possible to change default ports for example for “mailbox” but without luck. And secondly, on Yun there is a firewall, that is supposed not to accept any nonstandard comunication to Yun from Internet. I could buy a new router with port translation. Still… Which service would you use? Rest Api? Yunserver?

"on Yun there is a firewall"

Are you sure? Could you elaborate more on that?

I have Bluetooth working OK out of Arduino and into a processing app

The simplest method is to have the Yun make an outgoing connection to the server to fetch the data. No router configuration is needed and no port forwarding/translation.

If you must be able to accept an incoming connection, you can use a wide variety of methods on the Linux side to accept just about any type of connection on just about any port. If you insist on managing the connection in the Arduino sketch, you can use a YunServer object to set up an incoming TCP port listening on just about any port number.

I have Bluetooth working OK out of Arduino and into a processing app

And how does that get out to the Internet to the remote sever that is running the Processing script? I'm guessing you are running the Processing script on a local computer, which is also the other end of the Bluetooth link? If so, that doesn't really help here.


mart256 - I am not sure, but user sonyyu suggested that in this thread (or did I understand this wrong? Second post from the top) -

I managed to pass a "mailbox" api call to Yun after enabling the port 4002 on Yun as shown in this post that I strongly suggest to anybody trying to contact Yun from outside theire local network: Accessing Your YUN Worldwide - Arduino Yún - Arduino Forum

ShapeShifter - thanks for your idea. I was thinking about making the script write a .txt file on the server and than making the Arduino Yun to check this file and than if anything change - use this new data, but I thought that making the script and Yun "talk", would make more of a instant gratification, and this would also be more futureproof (If i wanted, to make the Arduino to respond to script "Hi, I've got your picture and i'm showing it", or making multiple users use the same script in one time). I will have to check my options and than will post what I decided for - thanks for the ideas.

And yup, bluetooth does not help in any way, since the processing script will be on a remote webserver hosted somwhere in the world, and on my side, there will be only Yun.