Example #1
0
 def handshake(self, ext=None):
     """
     Override handshake to include bot name and token for auth, queue
     subscribe to private channel.
     """
     # include auth info in handshake
     ext = {} if ext is None else ext
     ext["authentication"] = dict(user=self.serviceName, password=self._serviceToken)
     # do handshake
     BayeuxClient.handshake(self, ext)
Example #2
0
 def handshake(self, ext=None):
     '''
     Override handshake to include bot name and token for auth, queue
     subscribe to private channel.
     '''
     # include auth info in handshake
     ext = {} if ext is None else ext
     ext['authentication'] = dict(
         user=self.serviceName,
         password=self._serviceToken
     )
     # do handshake
     BayeuxClient.handshake(self, ext)
Example #3
0
    def __init__(self, botClass, serviceName, serviceToken, ioLoop, connectionInfo, appData):
        """Override constructor to store session info."""
        # pull url from connection info
        BayeuxClient.__init__(self, connectionInfo["url"])
        self.serviceName = serviceName
        self.appData = appData
        self._botClass = botClass
        self._serviceToken = serviceToken
        self._isSubbed = False
        self._bot = None
        self._ioLoop = ioLoop

        # channel name templates
        self._privateCh = "/service/bot/%s/" % self.serviceName
        self._publicCh = "/bot/%s" % self.serviceName
Example #4
0
    def __init__(self, botClass, serviceName, serviceToken, ioLoop, 
    connectionInfo, appData):
        '''Override constructor to store session info.'''
        # pull url from connection info
        BayeuxClient.__init__(self, connectionInfo['url'])
        self.serviceName = serviceName
        self.appData = appData
        self._botClass = botClass
        self._serviceToken = serviceToken
        self._isSubbed = False
        self._bot = None
        self._ioLoop = ioLoop
 
        # channel name templates
        self._privateCh = '/service/bot/%s/' % self.serviceName
        self._publicCh = '/bot/%s' % self.serviceName
Example #5
0
 def disconnect(self):
     '''Override to cleanup loop.'''
     self._ioLoop.stop()
     BayeuxClient.disconnect(self)
Example #6
0
 def publish(self, data):
     '''Sends a public reply to subscribes on a bot subchannel.'''
     BayeuxClient.publish(self, self._publicCh, data)
Example #7
0
 def reply(self, replyToken, data):
     '''Sends a private reply to a requestor.'''
     BayeuxClient.publish(self, self._privateCh + 'response', data, 
         id=replyToken)
Example #8
0
 def disconnect(self):
     '''Override to cleanup loop.'''
     self._ioLoop.stop()
     BayeuxClient.disconnect(self)
Example #9
0
 def publish(self, data):
     '''Sends a public reply to subscribes on a bot subchannel.'''
     BayeuxClient.publish(self, self._publicCh, data)
Example #10
0
 def reply(self, replyToken, data):
     '''Sends a private reply to a requestor.'''
     BayeuxClient.publish(self, self._privateCh + 'response', data, 
         id=replyToken)
Example #11
0
 def disconnect(self):
     """Override to cleanup loop."""
     self._ioLoop.stop()
     BayeuxClient.disconnect(self)
Example #12
0
 def reply(self, replyToken, data):
     """Sends a private reply to a requestor."""
     BayeuxClient.publish(self, self._privateCh + "response", data, id=replyToken)