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