kittycad.api.modeling.modeling_commands_ws.WebSocket

class kittycad.api.modeling.modeling_commands_ws.WebSocket(fps, post_effect, show_grid, unlocked_framerate, video_res_height, video_res_width, webrtc, client, pool=None, replay=None)[source][source]

Bases: object

A websocket connection to the API endpoint.

__init__(fps, post_effect, show_grid, unlocked_framerate, video_res_height, video_res_width, webrtc, client, pool=None, replay=None)[source][source]

Methods

__init__(fps, post_effect, show_grid, ...[, ...])

close()

Close the websocket.

recv()

Receive data from the websocket.

send(data)

Send data to the websocket.

send_binary(data)

Send data as bson to the websocket.

Attributes

ws

__annotations__ = {'ws': <class 'websockets.sync.client.ClientConnection'>}[source]
__dict__ = mappingproxy({'__module__': 'kittycad.api.modeling.modeling_commands_ws', '__annotations__': {'ws': <class 'websockets.sync.client.ClientConnection'>}, '__doc__': 'A websocket connection to the API endpoint.', '__init__': <function WebSocket.__init__>, '__enter__': <function WebSocket.__enter__>, '__exit__': <function WebSocket.__exit__>, '__iter__': <function WebSocket.__iter__>, 'send': <function WebSocket.send>, 'send_binary': <function WebSocket.send_binary>, 'recv': <function WebSocket.recv>, 'close': <function WebSocket.close>, '__dict__': <attribute '__dict__' of 'WebSocket' objects>, '__weakref__': <attribute '__weakref__' of 'WebSocket' objects>})[source]
__enter__()[source][source]
__exit__(exc_type, exc_value, traceback)[source][source]
__init__(fps, post_effect, show_grid, unlocked_framerate, video_res_height, video_res_width, webrtc, client, pool=None, replay=None)[source][source]
__iter__()[source][source]

Iterate on incoming messages.

The iterator calls recv() and yields messages in an infinite loop.

It exits when the connection is closed normally. It raises a ConnectionClosedError exception after a protocol error or a network failure.

Return type:

Iterator[RootModel[Union[SuccessWebSocketResponse, FailureWebSocketResponse]]]

__module__ = 'kittycad.api.modeling.modeling_commands_ws'[source]
close()[source][source]

Close the websocket.

recv()[source][source]

Receive data from the websocket.

Return type:

RootModel[Union[SuccessWebSocketResponse, FailureWebSocketResponse]]

send(data)[source][source]

Send data to the websocket.

send_binary(data)[source][source]

Send data as bson to the websocket.

ws: ClientConnection[source]