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