def handle_broadcast(self, message): # send message to all clients msg = message.data.get("payload") is_file = message.data.get("isBinary") if is_file: # TODO send file pass else: # send message to all clients server_msg = Message.serialize(msg) self.broadcast(server_msg)
def handle_send(self, message): # send message to client msg = message.data.get("payload") is_file = message.data.get("isBinary") peer = message.data.get("peer") if is_file: # TODO send file pass elif peer in self.clients: # send message to client client = self.clients[peer] payload = Message.serialize(msg) client.sendMessage(payload, False) else: LOG.error("That client is not connected") self.mycroft_send("hive.client.send.error", { "error": "That client is not connected", "peer": peer }, message.context)