Last change
on this file since 65:6936acbdb9bd 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:
527 bytes
|
Line | |
---|
1 | """ |
---|
2 | An XMPP subprotocol handler that acts as an XMPP Ping pinger. |
---|
3 | """ |
---|
4 | |
---|
5 | from wokkel.ping import PingClientProtocol |
---|
6 | |
---|
7 | class Pinger(PingClientProtocol): |
---|
8 | """ |
---|
9 | I send a ping as soon as I have a connection. |
---|
10 | """ |
---|
11 | |
---|
12 | def __init__(self, entity, sender=None): |
---|
13 | self.entity = entity |
---|
14 | self.sender = sender |
---|
15 | |
---|
16 | def connectionInitialized(self): |
---|
17 | def cb(response): |
---|
18 | print "*** Pong ***" |
---|
19 | |
---|
20 | print "*** Ping ***" |
---|
21 | d = self.ping(self.entity, sender=self.sender) |
---|
22 | d.addCallback(cb) |
---|
Note: See
TracBrowser
for help on using the repository browser.