getView() and subscribe to know when to render again.
Render the current view
render() once after subscribing. subscribe only calls the listener for future snapshots or status changes.
The listener receives no arguments. Read all current values from the client inside it.
Clean up subscriptions
Both subscription methods return an unsubscribe function:Refresh available actions
Available commands are not part of the state view. Ask for them after a ready snapshot:Render hidden values
Private fields are typed as the real value or a hidden envelope:Listen for events
Use events for transient effects such as animations, sounds, and activity messages:Track connection state
getStatus() returns:
connectingbefore the first snapshot.readywhen requests can be sent.reconnectingwhile a local event stream retries.errorafter an unrecoverable connection problem.closedafter the host ends the game or you calldispose().
getStateVersion() when you need to identify the snapshot currently rendered. It returns null before the first view.