Skip to content

Commit

Permalink
Improved documentation for on_connect by improving detail and clarity;
Browse files Browse the repository at this point in the history
…#493 would suggest that the docs were unclear.
  • Loading branch information
comrumino committed May 19, 2022
1 parent 7bfa7ee commit a69aad3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/docs/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ The first name in this list is considered the "proper name" of the service, whil
are considered aliases. This distinction is meaningless to the protocol and the registry server.

Your service class may also define two special methods: ``on_connect(self, conn)`` and
``on_disconnect(self, conn)``. These methods are invoked, not surprisingly, when a connection
has been established, and when it's been disconnected. Note that during ``on_disconnect``,
the connection is already dead, so you can no longer access any remote objects.
``on_disconnect(self, conn)``. The ``on_connect`` method is invoked when a connection has been established.
From the client-side perspective, ``on_connect`` is invoked each time a client successfully invokes ``rpyc.connect`` or any other function provided by the connection factory module: ``rpyc.utils.factory``. After the connection is dead, ``on_disconnect`` is invoked (you will not be able to access remote objects inside of ``on_disconnect``).

.. note::
Try to avoid overriding the ``__init__`` method of the service. Place all initialization-related
Expand Down

0 comments on commit a69aad3

Please sign in to comment.