octoprint_client#
SocketClient(url, use_ssl = False, daemon = True, **kwargs)
#
is_connected
property
#
Whether the web socket is connected or not.
connect()
#
Connects the socket.
disconnect()
#
Disconnect the web socket.
reconnect(timeout = None, disconnect = True)
#
Tries to reconnect to the web socket.
If timeout is set will try to reconnect over the specified timeout in seconds and return False if the connection could not be re-established.
If no timeout is provided, the method will block until the connection could be re-established.
If disconnect is set to True
will disconnect the socket explicitly
first if it is currently connected.
Parameters:
-
timeout
(
number
) –timeout in seconds to wait for the reconnect to happen.
-
disconnect
(
bool
) –Whether to disconnect explicitly from the socket if a connection is currently established (True, default) or not (False).
Returns:
-
–
bool - True if the reconnect was successful, False otherwise.
wait(timeout = None)
#
Waits for the closing of the socket or the timeout.