Install software:

opkg update
opkg install python-openssl
opkg install distribute
easy_install websocket-client
nano /mnt/sda1/testwebsocket.py
#!/usr/bin/python
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
root@Arduino:~# /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

Comments powered by CComment