client

📁 vuer-ai/vuer 📅 Jan 25, 2026
2
总安装量
2
周安装量
#64572
全站排名
安装命令
npx skills add https://github.com/vuer-ai/vuer --skill client

Agent 安装分布

windsurf 1
opencode 1
cursor 1
codex 1
antigravity 1

Skill 文档

VuerClient

Basic Usage

import asyncio
from vuer import VuerClient
from vuer.events import ClientEvent

class MyEvent(ClientEvent):
    etype = "MY_EVENT"

async def main():
    async with VuerClient(URI="ws://localhost:8012") as client:
        client.send @ MyEvent(value={"data": 123})  # Fire-and-forget
        await client.send(MyEvent(value="x"))       # Awaitable

asyncio.run(main())

Custom Events

class SetPositionEvent(ClientEvent):
    etype = "SET_POSITION"
    value = [0, 0, 0]  # Optional default

Receiving

event = await client.recv(timeout=5.0)

async for event in client:
    print(event.etype, event.value)

Server Handler

@app.add_handler("MY_EVENT")
async def on_event(event, session: VuerSession):
    session.upsert @ Box(key="box", position=event.value)