Function: subscribeToServerEvents()
subscribeToServerEvents(
client,options?):ServerEventsSubscription
Subscribe to the API server's SSE events stream. Uses the ApiClient for authentication — JWT, session tokens, and API keys are all handled automatically via the client's axios interceptors. Returns an object with addEventListener(type, handler) for typed event handling and close().
Parameters
client
options?
SubscribeToServerEventsOptions
Returns
Example
const sub = subscribeToServerEvents(client);
sub.addEventListener('notification.new', (data) => { ... });
sub.addEventListener('asset.updated', (data) => { ... });
// on unmount: sub.close();