rivetkit-client-protocol 2.3.0

Client protocol types for RivetKit
Documentation
# MARK: Core

type Cbor data

type ActorSpecifier struct {
	actorId: str
	generation: uint
	key: optional<str>
}

# MARK: WebSocket Server -> Client

type Init struct {
	actorId: str
	connectionId: str
}

type Error struct {
	group: str
	code: str
	message: str
	metadata: optional<Cbor>
	actionId: optional<uint>
	actor: optional<ActorSpecifier>
}

type ActionResponse struct {
	id: uint
	output: Cbor
}

type Event struct {
	name: str
	args: Cbor
}

type ToClientBody union {
	Init |
	Error |
	ActionResponse |
	Event
}

type ToClient struct {
	body: ToClientBody
}

# MARK: WebSocket Client -> Server

type ActionRequest struct {
	id: uint
	name: str
	args: Cbor
}

type SubscriptionRequest struct {
	eventName: str
	subscribe: bool
}

type ToServerBody union {
	ActionRequest |
	SubscriptionRequest
}

type ToServer struct {
	body: ToServerBody
}

# MARK: HTTP

type HttpActionRequest struct {
	args: Cbor
}

type HttpActionResponse struct {
	output: Cbor
}

type HttpQueueSendRequest struct {
	body: Cbor
	name: optional<str>
	wait: optional<bool>
	timeout: optional<u64>
}

type HttpQueueSendResponse struct {
	status: str
	response: optional<Cbor>
}

type HttpResponseError struct {
	group: str
	code: str
	message: str
	metadata: optional<Cbor>
	actor: optional<ActorSpecifier>
}

type HttpResolveRequest void

type HttpResolveResponse struct {
	actorId: str
}