Rev | Line | |
---|
[65] | 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): |
---|
[207] | 18 | print("*** Pong ***") |
---|
[65] | 19 | |
---|
[207] | 20 | print("*** Ping ***") |
---|
[65] | 21 | d = self.ping(self.entity, sender=self.sender) |
---|
| 22 | d.addCallback(cb) |
---|
Note: See
TracBrowser
for help on using the repository browser.