pylabrobot.liquid_handling.backends.websocket.WebSocketBackend.send_command#
- async WebSocketBackend.send_command(command: str, data: Dict[str, Any] | None = None, wait_for_response: bool = True) dict | None #
Send an event to the browser.
If a websocket connection has not been established, the event will be saved and sent when it is established.
- Parameters:
event – The event identifier.
wait_for_response (bool) – If
True
, the web socker backend will wait for a response from the browser . IfFalse
, it is not guaranteed that the response will be available for reading at a later time. This is useful for sending events that do not require a response. WhenTrue
, aValueError
will be raised if the response"success"
field is notTrue
.data (Dict[str, Any] | None) – The event arguments, which must be serializable by
json.dumps
.command (str)
- Returns:
The response from the browser, if
wait_for_response
isTrue
, otherwiseNone
.- Return type:
dict | None