Client Handles#

class viser.ClientHandle[source]#

A handle is created for each client that connects to a server. Handles can be used to communicate with just one client, as well as for reading and writing of camera state.

Similar to ViserServer, client handles also expose scene and GUI interfaces at ClientHandle.scene and ClientHandle.gui. If these are used, for example via a client’s SceneApi.add_point_cloud() method, created elements are local to only one specific client.

scene: SceneApi#

Handle for interacting with the 3D scene.

gui: GuiApi#

Handle for interacting with the GUI.

client_id: int#

Unique ID for this client.

camera: CameraHandle#

Handle for reading from and manipulating the client’s viewport camera.

flush() None[source]#

Flush the outgoing message buffer. Any buffered messages will immediately be sent. (by default they are windowed)

Return type:


atomic() ContextManager[None][source]#

Returns a context where: all outgoing messages are grouped and applied by clients atomically.

This should be treated as a soft constraint that’s helpful for things like animations, or when we want position and orientation updates to happen synchronously.


Context manager.

Return type:


send_file_download(filename: str, content: bytes, chunk_size: int = 1048576) None[source]#

Send a file for a client or clients to download.

  • filename (str) – Name of the file to send. Used to infer MIME type.

  • content (bytes) – Content of the file.

  • chunk_size (int) – Number of bytes to send at a time.

Return type: