Example #1
0
 def __init__(self):
     nonlocal app, websocket_id
     PytigonClientProtocolBase.__init__(self)
     WebSocketClientProtocol.__init__(self)
     self.app = app
     self.websocket_id = websocket_id
     app.websockets[websocket_id] = self
     self.status = 0
Example #2
0
 def __init__(self):
     nonlocal app, websocket_id
     PytigonClientProtocolBase.__init__(self)
     WebSocketClientProtocol.__init__(self)
     self.app = app
     self.websocket_id = websocket_id
     app.websockets[websocket_id] = self
     self.status = 0
Example #3
0
 def __init__(self, dirmanager_thread, dirmanager, rlock):
     self.dirmanager_thread = dirmanager_thread
     self.rlock = rlock
     self.dirmanager = dirmanager
     self.is_busy = False
     self.isSending = False
     self.index = 0
     self.START_HEADER = "START_HEADER"
     self.END_HEADER = "END_HEADER"
     self.START_DATA = "START_DATA"
     self.END_DATA = "END_DATA"
     self.FRAGMENT_SIZE = 64
     WebSocketClientProtocol.__init__(self)
     dirmanager_thread.set_sender(self)
Example #4
0
 def __init__(self):
     self.handlers = {
         "LoginRt": self.onLoginRt,
         "Pong": self.onPong_,
         "TaskList": self.onTaskList
     }
     self.USERNAME = "******"  # modify to your username(email)
     self.UUID = hex(
         uuid.getnode())[2:-1]  # modify to your uuid or keep default
     self.LOCALIP = "192.168.1.1"  # modify to your local ip (optional)
     self.DNSIP = "127.0.0.1"  # modify to your dns ip (optional)
     self.USERID = 0
     self.NODEID = 0
     self.MONITORRESULT = []
     self.REQTASK = 0
     self.FINISHTASK = 0
     WebSocketClientProtocol.__init__(self)
Example #5
0
    def __init__(self):
        self.handlers = {
            "LoginRt": self.onLoginRt,
            "Pong": self.onPong_,
            "TaskList": self.onTaskList
        }

        self.USERNAME = sys.argv[2]
        self.UUID = sys.argv[3]
        self.LOCALIP = sys.argv[4]
        self.DNSIP = sys.argv[5]
        self.USERID = 0
        self.NODEID = 0
        self.MONITORRESULT = []
        self.REQTASK = 0
        self.FINISHTASK = 0
        WebSocketClientProtocol.__init__(self)
Example #6
0
    def __init__(self, rtm_start_data, *a, **kw):
        BaseClient.__init__(self)

        # Slack prompts users to set up a bot account's name when setting up
        # the API key. So the bot's name is already defined server-side, and we
        # just have to look it up. In fact, we ignore settings.NICK.
        self.nickname = rtm_start_data['self']['name']

        # Additionally, it is just simpler to override the user's
        # COMMAND_PREFIX_BOTNICK setting here, so to reduce the need for manual
        # configuration.
        settings.COMMAND_PREFIX_BOTNICK = '@?' + self.nickname

        # Maps of channel/user id -> name
        channels = (
            (rtm_start_data.get('channels') or []) +
            (rtm_start_data.get('mpims') or []) +
            (rtm_start_data.get('ims') or []) +
            (rtm_start_data.get('groups') or [])
        )

        users = rtm_start_data.get('users') or []

        self._cache_all_channel_names(channels)
        self._cache_all_user_names(users)

        # FIXME: setup reactor recurring tasks to refresh the list of channels/users
        self.refresh_channels = task.LoopingCall(self._cache_all_channel_names)
        self.refresh_users = task.LoopingCall(self._cache_all_user_names)

        self.refresh_channels.start(60, now=False)
        self.refresh_users.start(60, now=False)

        # Check if i'm a bot
        self._i_am_bot = False

        for user in users:
            if user['name'] == self.nickname:
                self._i_am_bot = user['is_bot']
                break

        # With websockets, we'll get replies to messages we attempt to send.
        # Keep track of them in a map of request-id -> message
        self._requests = {}

        return WebSocketClientProtocol.__init__(self, *a, **kw)
Example #7
0
    def __init__(self, rtm_start_data, *a, **kw):
        BaseClient.__init__(self)

        # Slack prompts users to set up a bot account's name when setting up
        # the API key. So the bot's name is already defined server-side, and we
        # just have to look it up. In fact, we ignore settings.NICK.
        self.nickname = rtm_start_data['self']['name']

        # Additionally, it is just simpler to override the user's
        # COMMAND_PREFIX_BOTNICK setting here, so to reduce the need for manual
        # configuration.
        settings.COMMAND_PREFIX_BOTNICK = '@?' + self.nickname

        # Maps of channel/user id -> name
        channels = ((rtm_start_data.get('channels') or []) +
                    (rtm_start_data.get('mpims') or []) +
                    (rtm_start_data.get('ims') or []) +
                    (rtm_start_data.get('groups') or []))

        users = rtm_start_data.get('users') or []

        self._cache_all_channel_names(channels)
        self._cache_all_user_names(users)

        # FIXME: setup reactor recurring tasks to refresh the list of channels/users
        self.refresh_channels = task.LoopingCall(self._cache_all_channel_names)
        self.refresh_users = task.LoopingCall(self._cache_all_user_names)

        self.refresh_channels.start(60, now=False)
        self.refresh_users.start(60, now=False)

        # Check if i'm a bot
        self._i_am_bot = False

        for user in users:
            if user['name'] == self.nickname:
                self._i_am_bot = user['is_bot']
                break

        # With websockets, we'll get replies to messages we attempt to send.
        # Keep track of them in a map of request-id -> message
        self._requests = {}

        return WebSocketClientProtocol.__init__(self, *a, **kw)
Example #8
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     self.pingTask = task.LoopingCall(self.ping)
     self.gotPong = True
Example #9
0
	def __init__(self, *args, **kwargs):
		WebSocketClientProtocol.__init__(self, *args, **kwargs) #args needed?
Example #10
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     Adapter.__init__(self)
     self._subscribe_q = []
     self._listener_list = []  # no way to unsubscribe. Subscriptions last
Example #11
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     self.pingTask = task.LoopingCall(self.ping)
     self.gotPong = True
Example #12
0
 def __init__(self, *args, **kwargs):
     WebSocketClientProtocol.__init__(self, *args, **kwargs)
     self.fingerprint = "".join(
         random.choice("abcdefghijklmnopqrstuvwxyz") for i in range(16))
     stats[self.fingerprint] = {}
Example #13
0
 def __init__(self, adapter=None):
     WebSocketClientProtocol.__init__(self)
     self._adapter = adapter if adapter is not None else Broker.get_instance(
     ).pyadapter
Example #14
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     self._queue = []
Example #15
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     Session.__init__(self)
     self.restart_downtime = None
Example #16
0
 def __init__(self, output):
     WebSocketClientProtocol.__init__(self)
     self.output = output
Example #17
0
 def __init__(self, factory):
     WebSocketClientProtocol.__init__(self)
     self.factory=factory
Example #18
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     Adapter.__init__(self)
     self._subscribe_q = []
     self._listener_list = []  # no way to unsubscribe. Subscriptions last
Example #19
0
 def __init__(self, *args, **kwargs):
     WebSocketClientProtocol.__init__(self, *args, **kwargs)
     self.fingerprint = "".join(random.choice("abcdefghijklmnopqrstuvwxyz") for i in range(16))
     stats[self.fingerprint] = {}
Example #20
0
 def __init__(self):
     WebSocketClientProtocol.__init__(self)
     self._queue = []
Example #21
0
 def __init__(self, spectate, *args, **kwargs):
     WebSocketClientProtocol.__init__(self, *args, **kwargs)
     self.player = Player()
     self.ingame = False
     self.re_pattern = re.compile(u'[^\u0000-\uD7FF\uE000-\uFFFF]', re.UNICODE)
     self.spectate = spectate