Skip to main content

Publishing events

You can either publish standard ftrack events or leverage the event framework to publish your own events. In either case, once connected to the event server, you simply need to send an event of the appropriate form to the server under the ftrack.event namespace.

Remember that all supplied information can be used by subscribers to filter events, so the more accurate the information, the better.

Publish synchronously

With the python clients, it is also possible to publish events synchronously. In this case, the event would only be routed locally on that same client and never be sent to the main server. This can be useful for discovering local plugins etc.

Targeting events

In addition to subscribers filtering events to receive, it is also possible to give an event a specific target to help route it to the right subscriber.

To do this, set the target value on the event to an expression. The expression will filter against registered subscriber information.

For example, if you have many subscribers listening for an event, but only want one of those subscribers to get the event, you can target the event to the subscriber using its registered subscriber id:

{
'topic': 'my-company.topic',
'data': {
# The data payload of the event.
},
'target': 'id=my-custom-subscriber-id'
}

Sending replies

When handling an event, it is sometimes useful to be able to send information back to the source of the event. For example, ftrack.location.request-resolve would expect a resolved path to be sent back.

This is done by publishing a special reply event with the form:

{
'topic': 'ftrack.meta.reply',
'data': {
# The reply data payload.
},
'target': 'id={source-id-of-source-event}',
'inReplyToEvent': 'id-of-source-event'}
}

However, most clients will implement this functionality for you and allow you to just return a value from an event handler in order to issue a reply.