def onMessage(self, payload, isBinary): text = payload.decode('utf-8') d = dict(json.loads(text)) if d['type'] == 6001: broadcastDevices() elif d['type'] == 6002: message.sendTask(devices[d['deviceId']], bool(d['update']), d['tests'])
def onMessage(self, payload, isBinary): if isBinary: print('Binary message received: {0} bytes'.format(len(payload))) else: text = payload.decode('utf-8') d = dict(json.loads(text)) if d['type'] == 6003: message.sendTask(devices[self.deviceId])