WebGumps are a bidirectional communication channel between your shard’s server software and the ClassicUO Web mod layer. The server identifies each gump by aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ClassicUO/classicuo-web/llms.txt
Use this file to discover all available pages before exploring further.
type string and pushes JSON payloads to connected clients via network packets. On the client side, those payloads arrive as GumpUpdateEvent objects which your mod can consume with the useWebGump React hook or by listening to raw events with addEventListener.
When a WebGump is open, the mod can also send data back to the server with sendWebGumpResponse, or dismiss the gump with closeWebGump. The useWebGump hook wraps both functions into a convenient send() and close() API tied to the current gump identity.
Event Interfaces
Both interfaces are exported from@classicuo/modding.
GumpIdentity
The base identity shared by all gump events.
GumpUpdateEvent
Fired when the server sends a gump update payload. Extends GumpIdentity.
GumpCloseEvent
Fired when the server signals that a gump should close. Contains only the identity fields.
GumpInfo
A convenience type combining identity with a pre-parsed data field.
Event Naming Convention
WebGump events follow a predictable naming pattern based on the gumptype string:
| Event name | Fires when |
|---|---|
`webGump:${type}:update` | Server sends a payload for the gump of that type |
`webGump:${type}:close` | Server closes the gump of that type |
gumpUpdate | Any gump update arrives (not type-scoped) |
gumpClose | Any gump close arrives (not type-scoped) |
type = 'WebPlayerStatusGump' fires on the event names webGump:WebPlayerStatusGump:update and webGump:WebPlayerStatusGump:close.
useWebGump Hook
The useWebGump hook is the recommended way to consume WebGumps inside React components. It manages event subscriptions, JSON parsing, and gump identity tracking automatically.
Signature
The gump type string to subscribe to, e.g.
'WebPlayerStatusGump'. The hook internally subscribes to webGump:{type}:update and webGump:{type}:close events.Optional callback fired every time an update arrives, after the hook’s internal state has been updated. The event includes a
data field of type T | Error (an Error if JSON parsing failed).Return Value
The hook returns a discriminated union based on whether the gump is currently open or closed, extended with helper methods. When closed (closed: true):
closed: false):
The
send() and close() methods are always present in the return value. When the gump is closed (closed: true), calling either method is a safe no-op — they check the closed flag internally before dispatching.GumpUpdateEventWithData<T>
The extended event type passed to the optional onUpdate callback:
Complete Example
The following example shows a fully typed React component that renders a server-driven player status panel usinguseWebGump.
Raw Event Approach
If you prefer not to use React hooks — for example, in a class component or outside of a component tree — you can subscribe to WebGump events directly:See Also
API Reference
Full documentation for sendWebGumpResponse, closeWebGump, and addEventListener.
Shard Rules
Configure which features and scripting modes are available on your shard.