---
title: "vuer.events"
section: "Python API"
order: 4
description: "Python API reference for vuer.events"
---

# vuer.events

## Event

```python
class Event
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L9)

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

```python
ts: float
```

## ClientEvent

```python
class ClientEvent(Event)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L30)

## ClientEvent.__init__

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

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L36)

### Inherited members

- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
value = None
```

## InitEvent

```python
class InitEvent(ClientEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L54)

## InitEvent.__init__

```python
def __init__(self, **kwargs)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L55)

### Inherited members

- `value` — from [`vuer.events.ClientEvent`](/python-api/events#clientevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

## NullEvent

```python
class NullEvent(ClientEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L62)

## NullEvent.__init__

```python
def __init__(self, **kwargs)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L63)

### Inherited members

- `value` — from [`vuer.events.ClientEvent`](/python-api/events#clientevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

## ServerEvent

```python
class ServerEvent(Event)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L76)

## ServerEvent.__init__

```python
def __init__(self, data, etype=None, ts: Union[Datetime, Timedelta]=None, **kwargs)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L77)

## ServerEvent.serialize

```python
def serialize(self)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L91)

Serialize the event to a dictionary for sending over the websocket.
:return: A dictionary representing the event.

### Inherited members

- `ts` — from [`vuer.events.Event`](/python-api/events#event)

## Noop

```python
class Noop(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L100)

## Noop.__init__

```python
def __init__(self, **kwargs)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L103)

### Inherited members

- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'NOOP'
```

## Set

```python
class Set(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L110)

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](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L120)

:param data: The data to set.

### Inherited members

- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'SET'
```

## Update

```python
class Update(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L127)

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 @ &#123; "key": "my_key", "value": "$delete" &#125;

    app.update(&#123; "key": "my_key", "value": "$delete" &#125;, strict=True)

    app.update @ [ &#123; "key": "my_key", "value": "$delete" &#125;, ... ]

    app.update(&#123; "key": "my_key", "value": "$delete" &#125;, ...,  strict=True)

## Update.__init__

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

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L146)

## Update.serialize

```python
def serialize(self)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L150)

### Inherited members

- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'UPDATE'
```

## Add

```python
class Add(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L159)

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](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L180)

## Add.serialize

```python
def serialize(self)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L188)

### Inherited members

- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'ADD'
```

## Upsert

```python
class Upsert(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L198)

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](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L218)

## Upsert.serialize

```python
def serialize(self)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L227)

### Inherited members

- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'UPSERT'
```

## Remove

```python
class Remove(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L237)

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](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L245)

### Inherited members

- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'REMOVE'
```

## Frame

```python
class Frame(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L250)

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](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L258)

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

- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'FRAME'
```

## End

```python
class End(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L270)

A higher-level ServerEvent that wraps other ServerEvents

## End.__init__

```python
def __init__(self, **kwargs)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L277)

### Inherited members

- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'TERMINATE'
```

## ServerRPC

```python
class ServerRPC(ServerEvent)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L284)

```python
uuid: str
```

## ServerRPC.__init__

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

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L291)

### Inherited members

- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'RPC'
```

```python
rtype = 'RPC_RESPONSE@{uuid}'
```

## GrabRender

```python
class GrabRender(ServerRPC)
```

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L296)

A higher-level ServerEvent that wraps other ServerEvents

## GrabRender.__init__

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

[Source](https://github.com/vuer-ai/vuer-docs/blob/docs/v0.0.52/vuer/events.py#L303)

### Inherited members

- `uuid` — from [`vuer.events.ServerRPC`](/python-api/events#serverrpc)
- `rtype` — from [`vuer.events.ServerRPC`](/python-api/events#serverrpc)
- `serialize` — from [`vuer.events.ServerEvent`](/python-api/events#serverevent)
- `ts` — from [`vuer.events.Event`](/python-api/events#event)

```python
etype = 'GRAB_RENDER'
```

## Public imports

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

- [`Scene`](/python-api/schemas/scene_components#scene) — `vuer.schemas.scene_components.Scene`
- [`Element`](/python-api/schemas/html_components#element) — `vuer.schemas.html_components.Element`
- [`serializer`](/python-api/serdes#serializer) — `vuer.serdes.serializer`
