Example #1
0
    class PubNubService(PushServiceWrapper):

        def __init__(self, *args, **kwargs):
            super(PubNubService, self).__init__()

            self.api = Pubnub(
                self.pub_key,  
                self.sub_key,
                self.secret_key,
                self.use_ssl
            )


        def subscribe(self, channel):
            self.api.subscribe({
                'channel'  : channel,
                'callback' : self.receive 
            })


        def _send_data(self, channel, data):
            self.api.publish({
                'channel' : channel,
                'message' : data
            })
Example #2
0
    class PubNubService(PushServiceWrapper):
        def __init__(self, *args, **kwargs):
            super(PubNubService, self).__init__()

            self.api = Pubnub(self.pub_key, self.sub_key, self.secret_key,
                              self.use_ssl)

        def subscribe(self, channel):
            self.api.subscribe({'channel': channel, 'callback': self.receive})

        def _send_data(self, channel, data):
            self.api.publish({'channel': channel, 'message': data})