source: doc/examples/ping_s2s.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.1 KB
Line 
1"""
2An XMPP Ping server as a standalone server via s2s.
3
4This ping responder accepts and initiates server-to-server connections using
5dialback and listens on C{127.0.0.1} with the domain C{localhost}.
6"""
7
8from twisted.application import service, strports
9from wokkel import component, server
10from wokkel.ping import PingHandler
11
12# Configuration parameters
13
14S2S_PORT = 'tcp:5269:interface=127.0.0.1'
15SECRET = 'secret'
16DOMAIN = 'localhost'
17LOG_TRAFFIC = True
18
19
20# Set up the Twisted application
21
22application = service.Application("Ping Server")
23
24router = component.Router()
25
26serverService = server.ServerService(router, domain=DOMAIN, secret=SECRET)
27serverService.logTraffic = LOG_TRAFFIC
28
29s2sFactory = server.XMPPS2SServerFactory(serverService)
30s2sFactory.logTraffic = LOG_TRAFFIC
31s2sService = strports.service(S2S_PORT, s2sFactory)
32s2sService.setServiceParent(application)
33
34pingComponent = component.InternalComponent(router, DOMAIN)
35pingComponent.logTraffic = LOG_TRAFFIC
36pingComponent.setServiceParent(application)
37
38pingHandler = PingHandler()
39pingHandler.setHandlerParent(pingComponent)
Note: See TracBrowser for help on using the repository browser.