Subscribe to an event
The examples use the sharedCloudApi client created in Installation and belong inside your plugin’s methods.
Subscription and close it when your plugin stops. The event handling guide shows the complete plugin lifecycle and how to safely interact with your server platform from a callback.
Choose an event category
Server events describe individual server instances. Persistent server events describe changes to the persistent server itself, such as it being updated or starting a server instance.
Keep state accurate
Events notify you that something changed; query APIs provide the current state. Subscriptions only receive live events, so query the resource when your plugin starts or when missing an event would make its state incorrect. Close each subscription when you no longer need it. Bothclose() and unsubscribe() stop future delivery and can be called more than once.
Read callback data
Every callback providesgetNetworkId() and an ISO 8601 timestamp through getTimestamp(). The remaining getters depend on the event type.
Prefer the stable ID getter when identifying a resource.
Some event payloads omit the embedded model. In that case, model getters such as getServer(), getGroup(), and getBlueprint() throw IllegalStateException.
Query the matching resource API when you need its current data.
Server callback getters
Server callback getters
Group callback getters
Group callback getters
Persistent server callback getters
Persistent server callback getters
Blueprint callback getters
Blueprint callback getters