Debian Codegraph @

doc/examples/pinger_component.tac

raw
1 """
2 An XMPP Ping client as an external server-side component.
3
4 This pinger client assumes the domain C{pinger}.
5 """
6
7 from twisted.application import service
8 from twisted.words.protocols.jabber.jid import JID
9 from tx_xmpp import component
10 from pinger import Pinger
11
12 # Configuration parameters
13
14 EXT_HOST = 'localhost'
15 EXT_PORT = 5347
16 SECRET = 'secret'
17 DOMAIN = 'pinger'
18 OTHER_DOMAIN = 'ping'
19 LOG_TRAFFIC = True
20
21
22 # Set up the Twisted application
23
24 application = service.Application("Pinger Component")
25
26 router = component.Router()
27 pingerComponent = component.Component(EXT_HOST, EXT_PORT, DOMAIN, SECRET)
28 pingerComponent.logTraffic = LOG_TRAFFIC
29 pingerComponent.setServiceParent(application)
30
31 pingerHandler = Pinger(JID(OTHER_DOMAIN), JID(DOMAIN))
32 pingerHandler.setHandlerParent(pingerComponent)