Vuer

vuer.events

Event

python
class Event

Source

An event is a message sent from the server to the client.

python
ts: float

ClientEvent

python
class ClientEvent(Event)

Source

Event received from the client (browser).

Subclasses must define etype as a class attribute. For deserialization, etype is passed via kwargs and set via __dict__.update().

Example::

class MyEvent(ClientEvent): etype = "MY_EVENT"

python
etype: str

ClientEvent.init

python
def __init__(self, ts=None, **kwargs)

Source

Inherited members

python
value = None

InitEvent

python
class InitEvent(ClientEvent)

Source

Inherited members

python
etype = 'Init'

NullEvent

python
class NullEvent(ClientEvent)

Source

Inherited members

python
etype = 'NULL'

ServerEvent

python
class ServerEvent(Event)

Source

Event sent from the server to the client (browser).

Subclasses must define etype as a class attribute. The __init__ copies self.etype to the instance dict for serialization.

Example::

class MyServerEvent(ServerEvent): etype = "MY_SERVER_EVENT"

def init(self, data): super().init(data)

python
etype: str

ServerEvent.init

python
def __init__(self, data, ts: float=None, **kwargs)

Source

Inherited members

Noop

python
class Noop(ServerEvent)

Source

Noop.init

python
def __init__(self, **kwargs)

Source

Inherited members

python
etype = 'NOOP'

Set

python
class Set(ServerEvent)

Source

Set Operation (Server Event).

SET Operator is used exclusively to set the root Scene node. Throws an error (on the client side) if the data is not a Scene object.

Set.init

python
def __init__(self, data: Scene)

Source

:param data: The data to set.

Inherited members

python
etype = 'SET'

Update

python
class Update(ServerEvent)

Source

UPDATE Operator is used to update a specific node in the scene graph.

Use "$delete" value for elements you want to remove. Or "$strict" mode to copy the element verbatim.

Example: app.update @ { "key": "my_key", "value": "$delete" }

app.update({ "key": "my_key", "value": "$delete" }, strict=True)

app.update @ [ { "key": "my_key", "value": "$delete" }, ... ]

app.update({ "key": "my_key", "value": "$delete" }, ..., strict=True)

Update.init

python
def __init__(self, *elements: Element, strict=False)

Source

Inherited members

python
etype = 'UPDATE'

Add

python
class Add(ServerEvent)

Source

ADD Operator is used to insert new nodes to the scene graph. By default, it inserts into the root node, but you can specify a parent node to insert into via the to argument.

Note: only supports a single parent key right timestamp.

Example: app.add @ Element(...)

app.add @ [ Element(...), Element(...), ... ]

app.add(Element, to="my_parent_key")

app.add([Element, ...], to="my_parent_key")

Add.init

python
def __init__(self, *elements: List[Element], to: str=None)

Source

Inherited members

python
etype = 'ADD'

Upsert

python
class Upsert(ServerEvent)

Source

UPSERT Operator is used to update nodes to new values, when then they do not exist, insert new ones to the scene graph.

Note: only supports a single parent key right timestamp.

Example: app.upsert @ Element(...)

app.upsert @ [ Element(...), Element(...), ... ]

app.upsert(Element, to="my_parent_key")

app.upsert([Element, ...], to="my_parent_key")

Upsert.init

python
def __init__(self, *elements: List[Element], to: str=None, strict=False)

Source

Inherited members

python
etype = 'UPSERT'

Remove

python
class Remove(ServerEvent)

Source

An Update ServerEvent is sent to the client when the server wants to update the client's state. It appends the data sent in the Update ServerEvent to the client's current state.

Remove.init

python
def __init__(self, *keys: List[str], **kwargs)

Source

Inherited members

python
etype = 'REMOVE'

HapticActuatorPulse

python
class HapticActuatorPulse(ServerEvent)

Source

Haptic Actuator Pulse event to trigger haptic feedback on the client side.

HapticActuatorPulse.init

python
def __init__(self, left: Optional[TypedDict('ActuatorData', {'strength': float, 'duration': float})]=None, right: Optional[TypedDict('ActuatorData', {'strength': float, 'duration': float})]=None, **kwargs)

Source

Haptic Actuator Pulse event to trigger haptic feedback on the client side.

:param left: Optional dictionary with 'strength' and 'duration' for left actuator. :param right: Optional dictionary with 'strength' and 'duration' for right actuator. :param kwargs: Additional keyword arguments.

Inherited members

python
etype = 'HAPTIC_ACTUATOR_PULSE'

Frame

python
class Frame(ServerEvent)

Source

A higher-level ServerEvent that wraps other ServerEvents

python
ServerEvent: ServerEvent

Frame.init

python
def __init__(self, data: ServerEvent, frame_rate=60.0, **kwargs)

Source

Frame object returns a NOOP client event, to keep the on_socket generator running at a constant rate.

:param data: :param frame_rate: default to 60, set this for wait time between frames :param kwargs:

Inherited members

python
etype = 'FRAME'

End

python
class End(ServerEvent)

Source

A higher-level ServerEvent that wraps other ServerEvents

End.init

python
def __init__(self, **kwargs)

Source

Inherited members

python
etype = 'TERMINATE'

ServerRPC

python
class ServerRPC(ServerEvent)

Source

python
uuid: str

ServerRPC.init

python
def __init__(self, data, uuid=None, **kwargs)

Source

Inherited members

python
etype = 'RPC'
python
rtype = 'RPC_RESPONSE@{uuid}'

GrabRender

python
class GrabRender(ServerRPC)

Source

A higher-level ServerEvent that wraps other ServerEvents

GrabRender.init

python
def __init__(self, *, key: str='DEFAULT', **kwargs)

Source

Inherited members

python
etype = 'GRAB_RENDER'

MjStep

python
class MjStep(ServerRPC)

Source

A higher-level ServerEvent that wraps other ServerEvents

MjStep.init

python
def __init__(self, *, key: str='DEFAULT', **kwargs)

Source

Inherited members

python
etype = 'MJ_STEP'

MjRender

python
class MjRender(ServerRPC)

Source

A higher-level ServerEvent that wraps other ServerEvents

MjRender.init

python
def __init__(self, *, key: str='DEFAULT', **kwargs)

Source

Inherited members

python
etype = 'MJ_RENDER'

GetWebXRMesh

python
class GetWebXRMesh(ServerRPC)

Source

Request WebXR mesh data from the client.

This RPC event is used to request real-world mesh detection data from WebXR AR sessions. The client will respond with mesh data including vertices, indices, semantic labels, and transformation matrices.

Example Usage::

Request mesh data from the client

mesh_data = await session.get_webxr_mesh(key="webxr-mesh")

Access the mesh data

for mesh in mesh_data.value['meshes']: vertices = mesh['vertices'] indices = mesh['indices'] semantic_label = mesh.get('semanticLabel') matrix = mesh['matrix']

:param key: The key of the WebXRMesh component to query (default: "webxr-mesh") :param kwargs: Additional keyword arguments

GetWebXRMesh.init

python
def __init__(self, *, key: str='webxr-mesh', **kwargs)

Source

Inherited members

python
etype = 'GET_WEBXR_MESH'

Public imports

These symbols are available from this module. Their definitions are documented in the linked modules.

  • Elementvuer.schemas.html_components.Element
  • Scenevuer.schemas.scene_components.Scene
  • serializervuer.serdes.serializer