Network actions¶
This page documents Engine/network operational APIs, not ActionRegistry
categories or invented action names. There is no built-in network:* action
family in engine/actions.ts.
Engine connection controls¶
engine.connect("ws://localhost:3000");
// ... use the session while connected
engine.disconnect();
Engine.connect(url) creates a PeerConnection, or a HybridPeerManager when
the Engine was constructed with useWebRTC: true, and wires it to
ConsensusCore. disconnect() removes the network/sync attachment. Network
events are forwarded through the Engine emitter, including net:connected,
net:ready, net:message, net:error, and reconnect events.
Transport classes¶
PeerConnectionprovides WebSocket transport,connect(),disconnect(),sendToPeer(peerId, payload),broadcast(type, payload?), and reconnect configuration.HybridPeerManagerstarts with WebSocket signaling, can upgrade peers to WebRTC withupgradeToWebRTC(peerId), and falls back to WebSocket.MessageCodecencodes JSON or MessagePack and can compress binary payloads. Its encrypted flag is reserved; setting it currently throws “Encryption not yet implemented”.UniversalRelayServeris a stateless WebSocket relay. It routes peer messages/signaling and optionally multiplexes rooms; it does not own game state.AuthoritativeServerowns an Engine and exposes a separate JSON command protocol for clients.RoomAuthoritativeServeradds one Engine per room.
The network layer transports CRDT sync blobs for peer synchronization; it is not
a second command-dispatch implementation. Authoritative servers may accept a
wire dispatch command, but that is server protocol handling, not a
network:* registry category.