def start_update_loop(self): """ Update every server object in main loop and then send object's data to players """ while self.working: self.update_objects() json_data_to_send = client_server_tools.pack_patch(self.server_objects) # print("Send loop... ") for address, connection in self.connections.items(): messager.send_msg(connection, json_data_to_send) time.sleep(0.2)
def on_key_pressed(self, key_code): messager.send_msg(self.connection, str(key_code))