Skip to main content
  • Overview

    Events allow your application to dynamically respond to changes in user context in real time. These events are automatically captured when relevant changes occur. You can subscribe to them by registering event listeners.

    Key Considerations

    Please note the following:

    • Events will only trigger for active connections.
    • Events are not captured unless explicitly listened for.
    • A single instance of the eventQueue is shared across all connections.

    Quick Start Guide

    1. Start listening in the loop with listenForEvents.
      The function EventQueue.waitEvent returns a event when one is captured.
    const eventQueue = await EndpointFactory.getEventQueue();
    function listenForEvents(eventsQueue) {
    eventsQueue.waitEvent().then(event => {
    console.log("onEvent", event);
    listenForEvents(eventsQueue);
    });
    }
    listenForEvents(eventQueue);
    1. Subscribe to Tool (e.g. Thread) events:
    await threadApi.subscribeForMessageEvents(threadID);
    1. Unsubscribe, if events no longer needed:
    await threadApi.unsubscribeFromMessageEvents(threadID);