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