source: doc/examples/ping_server.tac @ 251:554782284e08

Last change on this file since 251:554782284e08 was 65:6936acbdb9bd, checked in by Ralph Meijer <ralphm@…>, 11 years ago

Add support for the XMPP Ping protocol.

Author: ralphm
Fixes #55.

This adds a whole bunch of examples around the ping protocol in different
settings for both the pinger and pingee: as a external server-side component,
as a standalone server with server-to-server connectivity and as a client.

Also updates the disco support to allow for non-deferred responses from
subprotocol handlers

File size: 1.0 KB
Line 
1"""
2An XMPP Ping server as a standalone server with external component service.
3
4This ping responder server uses the C{ping} domain, and also accepts External
5Component connections on port C{5347}, but only on C{127.0.0.1}.
6"""
7
8from twisted.application import service, strports
9from wokkel import component
10from wokkel.ping import PingHandler
11
12# Configuration parameters
13
14EXT_PORT = 'tcp:5347:interface=127.0.0.1'
15SECRET = 'secret'
16DOMAIN = 'ping'
17LOG_TRAFFIC = True
18
19
20# Set up the Twisted application
21
22application = service.Application("XMPP Ping Server")
23
24router = component.Router()
25
26componentServerFactory = component.XMPPComponentServerFactory(router, SECRET)
27componentServerFactory.logTraffic = LOG_TRAFFIC
28componentServer = strports.service(EXT_PORT, componentServerFactory)
29componentServer.setServiceParent(application)
30
31pingComponent = component.InternalComponent(router, DOMAIN)
32pingComponent.logTraffic = LOG_TRAFFIC
33pingComponent.setServiceParent(application)
34
35pingHandler = PingHandler()
36pingHandler.setHandlerParent(pingComponent)
Note: See TracBrowser for help on using the repository browser.