def send_push_notification(self): devices = self.user['devices'].values() topic = '45d4a8f8d83fdc7ba96233018fe1aa475fbccd6e'.decode('hex') payload = '{"r":"%s"}' % str(self.apple_id) log.msg('send_push_notification: Sending push notifications to ' 'tokens: %s' % repr(devices)) for device in devices: device = device.decode('hex') PushService.send_notification(device, topic, payload)
def connect_to_push_service(application): factory = PushService.create_factory() internet.TCPClient('127.0.0.1', 1234, factory) \ .setServiceParent(application)