You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The document says on_connect is called when the connection is established. However, in rpyc we don't build connection with server explicitly, thus it's not clear to end user when the connection is established.
Does this mean connection is established every time the remote call is invoked? Or when the remote sever process is launched?
The text was updated successfully, but these errors were encountered:
To answer your question directly, the server when started listens on a port; when another process or computer binds to that port they are attempting to establish a connection. Assuming the connection is established successfully, the server will call on_connect next.
The new version of the documentation is hopefully more clear.
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).
Edit by comrumino to add full documentation quote
The document says on_connect is called when the connection is established. However, in rpyc we don't build connection with server explicitly, thus it's not clear to end user when the connection is established.
Does this mean connection is established every time the remote call is invoked? Or when the remote sever process is launched?
The text was updated successfully, but these errors were encountered: