Ejemplo n.º 1
0
 def run_agent(owner, room, host, port, secure):
     global agent
     if agent:
         agent.stop()
         agent = None
     try:
         agent = AgentConnection(owner, room, host=host, port=port, secure=secure, on_connect=ON_CONNECT)
         # owner and room name are slugfields so this should be safe
         Listener.set_agent(agent)
         agent.connect()
     except Exception as e:
         print(e)
         tb = traceback.format_exc()
         print(tb)
     else:
         joined_room = {'url': room_url}
         update_recent_rooms(joined_room)
Ejemplo n.º 2
0
 def run_agent(owner, room, host, port, secure):
     global agent
     if agent:
         msg.debug('Stopping agent.')
         agent.stop()
         agent = None
     try:
         agent = AgentConnection(owner,
                                 room,
                                 host=host,
                                 port=port,
                                 secure=secure,
                                 on_connect=ON_CONNECT)
         # owner and room name are slugfields so this should be safe
         Listener.set_agent(agent)
         agent.connect()
     except Exception as e:
         print(e)
         tb = traceback.format_exc()
         print(tb)
     else:
         joined_room = {'url': room_url}
         update_recent_rooms(joined_room)