Skip to main content

@voxelize/protocol

Namespaces​

References​

default​

Renames and re-exports protocol

Type Aliases​

BulkUpdateProtocol​

Ƭ BulkUpdateProtocol: Object

Type declaration​

NameType
lightsnumber[]
voxelsnumber[]
vxnumber[]
vynumber[]
vznumber[]

ChatHistoryEntry​

Ƭ ChatHistoryEntry: Object

One line of a world's chat history, as the server replays it on join (the INIT chatHistory key) and pages it (vox-builtin:chat-history).

Type declaration​

NameTypeDescription
bodystring-
kindstringWho spoke as the server knows it: "player", "system", or a game kind.
metadatastring-
senderstring-
senderIdstring-
senderNamestring-
sentAtnumber-
seqnumber-
typestringThe chat protocol type the line was broadcast with.

ChatHistoryPage​

Ƭ ChatHistoryPage: Object

A page of chat history, oldest first.

Type declaration​

NameTypeDescription
entriesChatHistoryEntry[]-
hasMorebooleanWhether the server holds lines older than the first entry.

ChatProtocol​

Ƭ ChatProtocol: Object

Type declaration​

NameTypeDescription
bodystring-
metadata?string-
sender?string-
sentAt?numberUnix milliseconds the server logged the line at; zero when unlogged.
seq?numberPosition in the world's chat log, stamped by the server on every public line it keeps; zero (or absent) for a line it does not.
tSendMs?number-
traceId?string-
typestring-

ChunkProtocol​

Ƭ ChunkProtocol: Object

Type declaration​

NameTypeDescription
biomeTints?Uint8ArrayFour x-fast RGB corner multipliers, byte / 128.0; absent on older worlds.
idstring-
lightsUint32Array-
meshesMeshProtocol[]-
voxelsUint32Array-
xnumber-
znumber-

EntityMotionProtocol​

Ƭ EntityMotionProtocol: Object

The decoded compact motion payload of an entity UPDATE (the versioned motion.v1 wire format negotiated through the JOIN capabilities). Servers send it in place of JSON motion metadata to clients that advertised support; the client merges it back into the entity's metadata so consumer code keeps reading metadata.position / metadata.direction / metadata.rigidBody / metadata.target.position unchanged.

Type declaration​

NameType
direction?[number, number, number]
position[number, number, number]
rigidBody?{ fluidRatio: number ; isInFluid: boolean }
rigidBody.fluidRationumber
rigidBody.isInFluidboolean
targetPosition?[number, number, number]

EntityOperation​

Ƭ EntityOperation: "CREATE" | "UPDATE" | "DELETE" | "OUT_OF_RANGE"


EntityProtocol​

Ƭ EntityProtocol<T>: Object

Type parameters​

Name
T

Type declaration​

NameType
idstring
metadataT
motion?EntityMotionProtocol
operationEntityOperation
typestring

EventProtocol​

Ƭ EventProtocol<T>: Object

Type parameters​

Name
T

Type declaration​

NameType
namestring
payloadT

GeometryProtocol​

Ƭ GeometryProtocol: Object

Type declaration​

NameTypeDescription
at?[number, number, number]-
bsCenter?[number, number, number]-
bsRadius?number-
faceName?string-
indicesUint32Array-
lightTwist?Uint8ArrayPer-vertex quad light twist, four bytes per vertex, derived on the client from lights and indices (see the core's quad-light.ts). Absent on the wire; the mesh worker fills it in.
lightsUint32Array-
normals?Float32Array | Int8Array-
positionsFloat32Array | Uint16Array-
uvsFloat32Array | Uint16Array-
voxelnumber-

MeshProtocol​

Ƭ MeshProtocol: Object

Type declaration​

NameType
connectivity?number
geometriesGeometryProtocol[]
levelnumber

MessageProtocol​

Ƭ MessageProtocol<T, Peer, Entity, Event, Method>: Object

Type parameters​

NameType
Tany
Peerany
Entityany
Eventany
Methodany

Type declaration​

NameTypeDescription
bulkUpdate?BulkUpdateProtocol-
chat?ChatProtocol-
chunks?ChunkProtocol[]-
entities?EntityProtocol<Entity>[]-
events?EventProtocol<Event>[]-
json?T-
method?MethodProtocol<Method>-
peers?PeerProtocol<Peer>[]-
perfArrivedAt?numberperformance.now() when this message's raw bytes reached the client, before queueing and decode. Lets a chunk's timeline separate the server and wire from the client's own decode queue.
perfByteSize?number-
perfTraceId?string-
text?string-
tick?numberServer tick at which this message's payload was captured. Stamped on high-frequency state messages (ENTITY, PEER) so receivers can drop out-of-order state on unordered transports (WebRTC).
type"INIT" | "JOIN" | "LEAVE" | "ERROR" | "PEER" | "ENTITY" | "LOAD" | "UNLOAD" | "UPDATE" | "METHOD" | "CHAT" | "TRANSPORT" | "EVENT" | "ACTION" | "STATS"-
updates?UpdateProtocol[]-

MethodProtocol​

Ƭ MethodProtocol<T>: Object

Type parameters​

Name
T

Type declaration​

NameType
namestring
payloadT

PeerProtocol​

Ƭ PeerProtocol<T>: Object

Type parameters​

Name
T

Type declaration​

NameType
idstring
metadataT
usernamestring

UpdateProtocol​

Ƭ UpdateProtocol: Object

Type declaration​

NameType
light?number
voxel?number
vxnumber
vynumber
vznumber

Variables​

PROTOCOL_MISMATCH_CLOSE_CODE​

• Const PROTOCOL_MISMATCH_CLOSE_CODE: number = protocolVersion.mismatchCloseCode

Application WebSocket close code sent when the server refuses a client for a protocol-version mismatch. The client treats it as terminal (client_outdated): it never retries and never burns reconnect grace. Derived from the shared protocol-version.json (see above).


PROTOCOL_VERSION​

• Const PROTOCOL_VERSION: number = protocolVersion.version

Wire protocol version. Must match the server's PROTOCOL_VERSION constant (Rust). The client sends this on JOIN; a deterministic (fixed-step) world asserts strict equality and refuses a mismatch. Client + server deploy in lockstep on every bump.

SINGLE SOURCE OF TRUTH: this value is derived from protocol-version.json, the same file the Rust server compiles its PROTOCOL_VERSION from (include_str! + const parse). There is exactly one number; the two sides cannot silently drift.