source: doc/examples/pinger_client.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: 739 bytes
Line 
1"""
2An XMPP Ping client as an XMPP client.
3
4This pinger client logs in as C{pinger@example.org}.
5"""
6
7from twisted.application import service
8from twisted.words.protocols.jabber.jid import JID
9from wokkel import client
10from pinger import Pinger
11
12# Configuration parameters
13
14THIS_JID = JID('pinger@example.org')
15OTHER_JID = JID('ping.example.com')
16SECRET = 'secret'
17LOG_TRAFFIC = True
18
19
20# Set up the Twisted application
21
22application = service.Application("Pinger Component")
23
24pingerClient = client.XMPPClient(THIS_JID, SECRET)
25pingerClient.logTraffic = LOG_TRAFFIC
26pingerClient.setServiceParent(application)
27pingerClient.send('<presence/>') # Hello, OpenFire!
28
29pingerHandler = Pinger(OTHER_JID)
30pingerHandler.setHandlerParent(pingerClient)
Note: See TracBrowser for help on using the repository browser.