def handle_C2CS(self, data): """群发,非广播 """ message = data["message"] userids = data["clients"] log.debug("c2cs:%s", message) clis = [id2cli.get(userid) for userid in userids] for cli in clis: cli.send(message)
def handle_C2C(self, data): """客户端发给客户端的消息 """ dst_id = data["dst"] dst_cli = id2cli.get(dst_id) message = data["message"] log.debug("c2c:%s", message) if dst_cli: dst_cli.send(message) else: # TODO: 对方不在线,存库 pass