diff options
author | mathieui <mathieui@mathieui.net> | 2021-01-27 00:20:31 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-01-27 00:20:31 +0100 |
commit | 370abb1d983bf1aabff523d4bbc5c9b89a2becb8 (patch) | |
tree | 0d191cd7f9f47101fa2fb835760651bf5dee736e /docs/getting_started/sendlogout.rst | |
parent | 70b508101896e8076228059fdd4726c2c39fa831 (diff) | |
parent | 51866f0d46a932f2b720bc876eb4bef50cfb277d (diff) | |
download | slixmpp-370abb1d983bf1aabff523d4bbc5c9b89a2becb8.tar.gz slixmpp-370abb1d983bf1aabff523d4bbc5c9b89a2becb8.tar.bz2 slixmpp-370abb1d983bf1aabff523d4bbc5c9b89a2becb8.tar.xz slixmpp-370abb1d983bf1aabff523d4bbc5c9b89a2becb8.zip |
Merge branch 'block-threaded-examples-docs' into 'master'
Remove the remaining block and threaded from examples
See merge request poezio/slixmpp!105
Diffstat (limited to 'docs/getting_started/sendlogout.rst')
-rw-r--r-- | docs/getting_started/sendlogout.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/getting_started/sendlogout.rst b/docs/getting_started/sendlogout.rst index 3b5d6d5a..defbf278 100644 --- a/docs/getting_started/sendlogout.rst +++ b/docs/getting_started/sendlogout.rst @@ -31,23 +31,23 @@ for the JID that will receive our message, and the string content of the message self.add_event_handler('session_start', self.start) - def start(self, event): + async def start(self, event): self.send_presence() - self.get_roster() + await self.get_roster() Note that as in :ref:`echobot`, we need to include send an initial presence and request the roster. Next, we want to send our message, and to do that we will use :meth:`send_message <slixmpp.basexmpp.BaseXMPP.send_message>`. .. code-block:: python - def start(self, event): + async def start(self, event): self.send_presence() - self.get_roster() + await self.get_roster() self.send_message(mto=self.recipient, mbody=self.msg) Finally, we need to disconnect the client using :meth:`disconnect <slixmpp.xmlstream.XMLStream.disconnect>`. -Now, sent stanzas are placed in a queue to pass them to the send thread. +Now, sent stanzas are placed in a queue to pass them to the send routine. :meth:`disconnect <slixmpp.xmlstream.XMLStream.disconnect>` by default will wait for an acknowledgement from the server for at least `2.0` seconds. This time is configurable with the `wait` parameter. If `0.0` is passed for `wait`, :meth:`disconnect @@ -55,9 +55,9 @@ the `wait` parameter. If `0.0` is passed for `wait`, :meth:`disconnect .. code-block:: python - def start(self, event): + async def start(self, event): self.send_presence() - self.get_roster() + await self.get_roster() self.send_message(mto=self.recipient, mbody=self.msg) |