nanover.websocket.client.interaction_client module
- class nanover.websocket.client.interaction_client.InteractionClient(*args, **kwargs)
Bases:
WebsocketClient
Mixin of methods for managing iMD interactions with a WebSocketClient.
- close()
- property interactions: dict[str, ParticleInteraction]
- start_interaction(interaction: ParticleInteraction | None = None) str
Start an interaction with the IMD server.
- Parameters:
interaction – An optional :class: ParticleInteraction with which to begin.
- Returns:
The unique interaction ID of this interaction, which can be used to update the interaction with
update_interaction()
.- Raises:
ValueError, if the there is no IMD connection available.
- stop_all_interactions()
Stops all active interactions governed by this client.
- stop_interaction(interaction_id: str) bool
Stops the interaction identified with the given interaction_id on the server. This method blocks until the server returns a reply indicating that the interaction has stopped.
- Parameters:
interaction_id – The unique interaction ID, created with
start_interaction()
, that identifies the interaction to stop.- Returns:
An
InteractionEndReply
, which is an empty message indicating successful termination of the interaction.- Raises:
ValueError – if the there is no IMD connection available, or if invalid parameters are passed to the server.
KeyError – if the given interaction ID does not exist.
- update_interaction(interaction_id: str, interaction: ParticleInteraction)
Updates the interaction identified with the given interaction_id on the server with parameters from the given interaction.
- Parameters:
interaction_id – The unique id of the interaction to be updated.
interaction – The :class: ParticleInteraction providing new parameters for the interaction.
- Raises:
ValueError, if the there is no IMD connection available, or if invalid parameters are passed to the server.
- Raises:
KeyError – if the given interaction ID does not exist.