rivetkit-python/client/README.md
The Python client for RivetKit, the Stateful Serverless Framework
Use this client to connect to RivetKit services from Python applications.
pip install python-rivetkit-client
from python_rivetkit_client import AsyncClient as ActorClient
import asyncio
async def main():
# Create a client connected to your RivetKit manager
client = ActorClient("http://localhost:8080")
# Connect to a chat room actor
chat_room = await client.get("chat-room", tags=[("room", "general")])
# Listen for new messages
chat_room.on_event("newMessage", lambda msg: print(f"New message: {msg}"))
# Send message to room
await chat_room.action("sendMessage", ["alice", "Hello, World!"])
# When finished
await chat_room.disconnect()
if __name__ == "__main__":
asyncio.run(main())
AsyncClienton_eventreceive methoddisconnectApache 2.0