Skip to content

octoprint_client#

SocketClient #

connect() #

Connects the socket.

disconnect() #

Disconnect the web socket.

is_connected() property #

Whether the web socket is connected or not.

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:

Name Type Description Default
timeout number

timeout in seconds to wait for the reconnect to happen.

None
disconnect bool

Whether to disconnect explicitly from the socket if a connection is currently established (True, default) or not (False).

True

Returns:

Type Description

bool - True if the reconnect was successful, False otherwise.

wait(timeout=None) #

Waits for the closing of the socket or the timeout.

Back to top