@maxhealth.tech/prefab / actions / Subscribe
Class: Subscribe
Defined in: actions/subscribe.ts:45
Subscribe to a resource URI for real-time updates.
When the host supports MCP resource subscriptions (capabilities.subscriptions), the renderer uses push notifications via the bridge. Otherwise it falls back to periodic polling using SetInterval + CallTool.
Example
ts
new Subscribe('chess://game/abc123', {
stateKey: '$game',
fallbackInterval: 2000,
fallbackTool: '_action',
fallbackArgs: { action: 'refresh' },
onData: new ShowToast('Game updated', { variant: 'info' }),
})Implements
Constructors
Constructor
ts
new Subscribe(uri, opts): Subscribe;Defined in: actions/subscribe.ts:46
Parameters
| Parameter | Type |
|---|---|
uri | string |
opts | SubscribeOpts |
Returns
Subscribe
Properties
uri
ts
readonly uri: string;Defined in: actions/subscribe.ts:47
Methods
toJSON()
ts
toJSON(): ActionJSON;Defined in: actions/subscribe.ts:51