File: ping_server.tac

package info (click to toggle)
wokkel 18.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,352 kB
  • sloc: python: 11,753; makefile: 6
file content (36 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
An XMPP Ping server as a standalone server with external component service.

This ping responder server uses the C{ping} domain, and also accepts External
Component connections on port C{5347}, but only on C{127.0.0.1}.
"""

from twisted.application import service, strports
from wokkel import component
from wokkel.ping import PingHandler

# Configuration parameters

EXT_PORT = 'tcp:5347:interface=127.0.0.1'
SECRET = 'secret'
DOMAIN = 'ping'
LOG_TRAFFIC = True


# Set up the Twisted application

application = service.Application("XMPP Ping Server")

router = component.Router()

componentServerFactory = component.XMPPComponentServerFactory(router, SECRET)
componentServerFactory.logTraffic = LOG_TRAFFIC
componentServer = strports.service(EXT_PORT, componentServerFactory)
componentServer.setServiceParent(application)

pingComponent = component.InternalComponent(router, DOMAIN)
pingComponent.logTraffic = LOG_TRAFFIC
pingComponent.setServiceParent(application)

pingHandler = PingHandler()
pingHandler.setHandlerParent(pingComponent)