Websocket events
By subscribing to the ftrack.update topic, you connect your application or script to the ftrack event hub. When an entity is changed, an event is emitted on this topic and your callback function is triggered.
Inside the callback, you can process the received event data and take necessary actions based on the changes.
- Python
 - JavaScript
 
import ftrack_api
# Define a function to handle the received event
def my_callback(event):
    # Iterate through the updated entities and print their data
    for entity in event['data']['entities']:
        # Print data for the entity
        print(entity)
# Create a session and automatically connect to the event hub
session = ftrack_api.Session(auto_connect_event_hub=True)
# Subscribe to events with the 'ftrack.update' topic
session.event_hub.subscribe('topic=ftrack.update', my_callback)
import { Session } from "@ftrack/api";
// Define a function to handle the received event
function myCallback(event) {
  // Iterate through the updated entities and print their data
  event.data.entities.forEach((entity) => {
    // Print data for the entity
    console.log(entity);
  });
}
// Create a session and automatically connect to the event hub
const session = new Session({ autoConnectEventHub: true });
// Subscribe to events with the 'ftrack.update' topic
session.eventHub.subscribe("topic=ftrack.update", myCallback);