Event Types
vuer.events

vuer.events.Datetime

alias of datetime

vuer.events.Timedelta

alias of timedelta

class vuer.events.TypedDict[source]

Bases: dict

A simple typed namespace. At runtime it is equivalent to a plain dict.

TypedDict creates a dictionary type that expects all of its instances to have a certain set of keys, where each key is associated with a value of a consistent type. This expectation is not checked at runtime but is only enforced by type checkers. Usage:

class Point2D(TypedDict):
    x: int
    y: int
    label: str

a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check

assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')

The type info can be accessed via Point2D.__annotations__. TypedDict supports two additional equivalent forms:

Point2D = TypedDict('Point2D', x=int, y=int, label=str)
Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

By default, all keys must be present in a TypedDict. It is possible to override this by specifying totality. Usage:

class point2D(TypedDict, total=False):
    x: int
    y: int

This means that a point2D TypedDict can have any of the keys omitted.A type checker is only expected to support a literal False or True as the value of the total argument. True is the default, and makes all items defined in the class body be required.

The class syntax is only supported in Python 3.6+, while two other syntax forms work for Python 2.7 and 3.2+

static __new__(cls, typename, fields=None, /, *, total=True, **kwargs)
class vuer.events.Event[source]

Bases: object

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

ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.ClientEvent[source]

Bases: Event

ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

value = None
class vuer.events.InitEvent[source]

Bases: ClientEvent

ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.NullEvent[source]

Bases: ClientEvent

ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.ServerEvent[source]

Bases: Event

ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Noop[source]

Bases: ServerEvent

etype = 'NOOP'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Set[source]

Bases: ServerEvent

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.

etype = 'SET'

The Event Type.

ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Update[source]

Bases: ServerEvent

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)

etype = 'UPDATE'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Add[source]

Bases: ServerEvent

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”)

etype = 'ADD'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Upsert[source]

Bases: ServerEvent

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”)

etype = 'UPSERT'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Remove[source]

Bases: ServerEvent

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.

etype = 'REMOVE'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.HapticActuatorPulse[source]

Bases: ServerEvent

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

etype = 'HAPTIC_ACTUATOR_PULSE'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.Frame[source]

Bases: ServerEvent

A higher-level ServerEvent that wraps other ServerEvents

ServerEvent: ServerEvent
etype = 'FRAME'
class vuer.events.End[source]

Bases: ServerEvent

A higher-level ServerEvent that wraps other ServerEvents

etype = 'TERMINATE'
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.ServerRPC[source]

Bases: ServerEvent

etype = 'RPC'
rtype = 'RPC_RESPONSE@{uuid}'
uuid: str
class vuer.events.GrabRender[source]

Bases: ServerRPC

A higher-level ServerEvent that wraps other ServerEvents

etype = 'GRAB_RENDER'
uuid: str
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.MjStep[source]

Bases: ServerRPC

A higher-level ServerEvent that wraps other ServerEvents

etype = 'MJ_STEP'
uuid: str
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.MjRender[source]

Bases: ServerRPC

A higher-level ServerEvent that wraps other ServerEvents

etype = 'MJ_RENDER'
uuid: str
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

class vuer.events.GetWebXRMesh[source]

Bases: ServerRPC

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']
Parameters:
  • key – The key of the WebXRMesh component to query (default: “webxr-mesh”)

  • kwargs – Additional keyword arguments

uuid: str
ts: float

timestamp is a float representing the UTC datetime. Msgpack natively supports this. datetime’s Datetime class is significantly more complex as it includes timezone information.

etype = 'GET_WEBXR_MESH'