Hi NoblePepper & all,
I know you can help me out in this.
I have small c program running in Linino. I want to use websockets to communicate to outside ( web)
Is there an implementation of WebSocket like cURL library in Linino. or any help in this regard is highly appreciated.
If somebody has done this, please can you send/point me to documentation on this
Thanks in advance.
BRE
I do it by using Tornado Web Server which is implemented in python.
See here: http://www.tornadoweb.org
To install it on Linino, follow this instruction:
opkg update #updates the available packages list
opkg install distribute #it contains the easy_install command line tool
opkg install python-openssl #adds ssl support to python
opkg install pyopenssl
easy_install pip #installs pip
pip install tornado
Mamu,
Thank you very much.
I see most of the example are Python based.
I need to implement this in C language.
Can you point me some documentation on this.
Thanks
BRE
Sorry, didn't realize that you are looking for a C based web sever.
I would my stuff in C and store the result on the SD which my tornado server would monitor and send the (transformed/extended) data using web sockets.
Remember that you only have a python runtime on Lininio. When you go the C road, you will have to compile everything on a matching Linino tool chain. That looks more complicated compared to changing python scripts.
Hi Mamu,
Thank you very much for the reply.
I got this c library reference from MIT : https://code.google.com/p/cwebsocket/w/list Looks promising so far.
As fall back option recommended by you using Python ( I am not familiar ) following along using simple Python WebSocket Client to poll for data from remote website:
- Can you please point me to documentation of Python Websocket Client code
- Is it possible to call c exe inside a python code.
Thanks you very very much ! Sincerely appreciate your help
Regards,
BRE
Regarding your questions
- No, sorry, my Web Socket clients are HTML5 based web pages running in browsers. I have not done any tornado initiated web socket communication.
- sure, you can call any other process from python scripts.
The work flow: ATmega32u4->Bridge->AR9331->websocket client->external websocket Server
The external websocket Server (hosting at an other machine) could be Tornado Web Server as mamu indicate or Node.js server as
http://forum.arduino.cc/index.php?topic=215615.msg1577369#msg1577369
The websocket client example:
opkg update
opkg install nano
opkg install python-openssl
opkg install python-expat
opkg install distribute
easy_install pip
pip install websocket-client
nano /mnt/sda1/testwebsocket.py
#!/usr/bin/python
import sys
sys.path.insert(0, '/usr/lib/python2.7/site-packages/')
from websocket import create_connection
ws = create_connection("ws://echo.websocket.org/")
print "Sending 'Hello, World from Yun'..."
ws.send("Hello, World from Yun")
print "Sent..."
print "Reeiving..."
result = ws.recv()
print "Received '%s'" % result
ws.close()
chmod 755 /mnt/sda1/testwebsocket.py
/mnt/sda1/testwebsocket.py
Sending 'Hello, World from Yun'...
Sent...
Reeiving...
Received 'Hello, World from Yun'
"ws://echo.websocket.org/" is websocket testing server.
websocket-client
Dear Sonnyyu and Mamu,
Thank you very much.
This is what I needed. Will go ahead with Phython implementation and keep you posted
Once again. Thank you so much.
Regards
BREL
@manu
I tryed to install all that stuff
opkg update #updates the available packages list
opkg install distribute #it contains the easy_install command line tool
opkg install python-openssl #adds ssl support to python
opkg install pyopenssl
easy_install pip #installs pip
pip install tornado
But I don't have enough space on my linino... Are there any originaly installed packages that I can delete without destroying linino functionality ?
Hm, interesting. Worked on my machine/Linino without deinstalling anthing. Have you installed any additional software?
Yes: php5 & mysql. I need all this stuff
I will create a new ext4 filesystem on my sdcard and install all there.