def broadcast(self, msg): msg = encode(msg) for conn in self.leaving: self.conns.remove(conn) self.leaving.clear() for conn in self.conns: conn.send(msg)
def __init__(self, conn, race): self.conn = conn self.race = race self.conn.set_rmode_delimiter(DELIM, self.__parse_input) self.name = None self.score = 0 self.active = True players = [[player.name, player.score] for player in self.race.conns if player.name] players.sort(score_sort) self.send(encode(["WELCOME", [self.race.current, players]]))
def alert(self, msg): self.send(encode(["ALERT", msg]))
def signedin(self): self.send(encode(["SIGNEDIN"]))