In [2]:
!pip install socketIO-client


Downloading/unpacking socketIO-client
  Downloading socketIO-client-0.5.3.tar.gz
  Running setup.py (path:/private/var/folders/_4/zgq072js02l52sty2qmssbxm0000gn/T/pip_build_brian/socketIO-client/setup.py) egg_info for package socketIO-client
    
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Requirement already satisfied (use --upgrade to upgrade): requests in ./anaconda/lib/python2.7/site-packages (from socketIO-client)
Requirement already satisfied (use --upgrade to upgrade): six in ./anaconda/lib/python2.7/site-packages (from socketIO-client)
Downloading/unpacking websocket-client (from socketIO-client)
  Downloading websocket-client-0.14.1.tar.gz (189kB): 189kB downloaded
  Running setup.py (path:/private/var/folders/_4/zgq072js02l52sty2qmssbxm0000gn/T/pip_build_brian/websocket-client/setup.py) egg_info for package websocket-client
    
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in ./anaconda/lib/python2.7/site-packages (from websocket-client->socketIO-client)
Installing collected packages: socketIO-client, websocket-client
  Running setup.py install for socketIO-client
    
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
  Running setup.py install for websocket-client
    changing mode of build/scripts-2.7/wsdump.py from 644 to 755
    
    changing mode of /Users/brian/anaconda/bin/wsdump.py to 755
Successfully installed socketIO-client websocket-client
Cleaning up...

In [9]:
#setup listeners
from socketIO_client import SocketIO, BaseNamespace
 
class Namespace(BaseNamespace):
 
    def on_connect(self):
        print '[Connected]'
 
def on_data_response(*args):
    print 'navdata', args
 
def on_status_response(*args):
    print 'status ', args
 
socketIO = SocketIO('192.168.1.13', 8080, Namespace)
 
# sent by OpenROVController.js
# 'navdata' at 10 per sec
#socketIO.on('navdata', on_data_response)
 
# 'status' at 1 per second (includes navdata)
socketIO.on('status', on_status_response)

#socketIO.wait()

In [11]:
# Turn lights on
socketIO.emit('brightness_update',1)

In [8]:


In [12]:
# Turn lights off
socketIO.emit('brightness_update',0)

In [ ]: