def __init__(self, store, host, port, certPath, keyPath, chainPath="", passphrase="", sslMethod="TLSv1_METHOD", staggerNotifications=False, staggerSeconds=3, testConnector=None, reactor=None): APNConnectionService.__init__(self, host, port, certPath, keyPath, chainPath=chainPath, passphrase=passphrase, sslMethod=sslMethod, testConnector=testConnector, reactor=reactor) self.store = store self.factory = None self.queue = [] if staggerNotifications: self.scheduler = PushScheduler(self.reactor, self.sendNotification, staggerSeconds=staggerSeconds) else: self.scheduler = None
def __init__(self, controlSocket, parentService, port, enableStaggering, staggerSeconds, reactor=None): if reactor is None: from twisted.internet import reactor from twisted.application.strports import service as strPortsService if port: # Service which listens for client subscriptions and sends # notifications to them strPortsService(str(port), AMPPushNotifierFactory(self), reactor=reactor).setServiceParent(parentService) if controlSocket is not None: # Set up the listener which gets notifications from the slaves controlSocket.addFactory(PUSH_ROUTE, AMPPushMasterListenerFactory(self)) self.subscribers = [] if enableStaggering: self.scheduler = PushScheduler(reactor, self.sendNotification, staggerSeconds=staggerSeconds) else: self.scheduler = None