Requirements

pip install socketIO-client

Example

<syntaxhighlight lang="python"> from socketIO_client import SocketIO import json

def on_connect():

   print('connect')

def on_disconnect():

   print('disconnect')

def on_reconnect():

   print('reconnect')

def on_mqtt(*args):

   #print('on_mqtt', args)
   call = json.loads(args[0]['payload'])
   print json.dumps(call,separators=(',',':'),sort_keys=True,indent=4)

socket = SocketIO('https://api.brandmeister.network/lh') socket.on('connect', on_connect) socket.on('disconnect', on_disconnect) socket.on('reconnect', on_reconnect) socket.on('mqtt', on_mqtt) socket.wait() </syntaxhighlight>

Requirements[edit]

pip install socketIO-client

Example[edit]

<syntaxhighlight lang="python"> from socketIO_client import SocketIO import json

def on_connect():

   print('connect')

def on_disconnect():

   print('disconnect')

def on_reconnect():

   print('reconnect')

def on_mqtt(*args):

   #print('on_mqtt', args)
   call = json.loads(args[0]['payload'])
   print json.dumps(call,separators=(',',':'),sort_keys=True,indent=4)

socket = SocketIO('https://api.brandmeister.network/lh') socket.on('connect', on_connect) socket.on('disconnect', on_disconnect) socket.on('reconnect', on_reconnect) socket.on('mqtt', on_mqtt) socket.wait() </syntaxhighlight>