Ejemplo n.º 1
0
 def __init__(self):
     self.config = SockJSServerSettings()
     self.connect_tries = 0
     self.connecting = False
     self.last_reconnect = None
     self.connect()
     self.logger = logging.getLogger(__name__)
 def __init__(self, *args, **kw):
     self.subscribe = Subscribe(self)
     self.redis = redis_client
     self.logger = logging.getLogger(__name__)
     self.conf = SockJSServerSettings()
     self.id = self._generate_connection_id()
     super(SockJSConnection, self).__init__(*args, **kw)
Ejemplo n.º 3
0
    def __init__(self, connection):
        u'''
            connection: django_sockjs_server.lib.sockjs_handler.SockJSConnection
        '''
        self.conn = connection
        self.logger = logging.getLogger(__name__)
        self.redis = redis_client

        self.config = SockJSServerSettings()
Ejemplo n.º 4
0
    def __init__(self, io_loop):
        self.logger = logging.getLogger(__name__)
        self.logger.info('PikaClient: __init__')
        self.io_loop = io_loop

        self.connected = False
        self.connecting = False
        self.connection = None
        self.channel = None

        self.redis = redis_client
        self.event_listeners_count = 0
        self.event_listeners = set()
        self.subscrib_channel = dict()
        self.last_reconnect = now()
        self.uptime_start = now()

        self.config = SockJSServerSettings()
    def handle(self, *args, **options):
        logger = logging.getLogger(__name__)
        logger.info('start django-sockjs-server')
        self.config = SockJSServerSettings()

        io_loop = tornado.ioloop.IOLoop.instance()

        router = SockJSRouterPika(SockJSConnection,
                                  self.config.listen_location,
                                  user_settings=self.config.router_settings)
        app = tornado.web.Application(
            [(r"/stats/(.*)", StatsHandler,
              dict(pika_client=router._connection.pika_client))] + router.urls)

        app.listen(self.config.listen_port, address=self.config.listen_addr)
        try:
            io_loop.start()
        except KeyboardInterrupt:
            pass
def sockjs_server_url():
    config = SockJSServerSettings()
    return choice(config.sockjs_url)
Ejemplo n.º 7
0
 def __init__(self):
     self.logger = logging.getLogger(__name__)
     self.config = SockJSServerSettings()
     self.connected = False
     self.retry_count = 0
     self.redis = redis_client
Ejemplo n.º 8
0
 def __init__(self):
     self.config = SockJSServerSettings()