Andriy Babak Posted June 12, 2020 Report Posted June 12, 2020 Hi, I need to send an application launch event to a running ftrack connect of current user. I tried many options but the events just go to nowhere. As I started to test the event system I came across the "send_message_to_user" code from the "ftrack-recipes" that looked like a good start. Unfortunately, this code shows exactly the same: the evnts are sent but never received. I've double checked that the session.api_user is the same and the connection is established to the same server. I tried to switch the 'synchronous' option but that didn't change anything. Here's my test code that runs fine but no messages are shown in the web client: import ftrack_api def main(): """ Main entry point """ # Subscribe to events with the update topic. session = ftrack_api.Session(auto_connect_event_hub=True) session.event_hub.publish( ftrack_api.event.base.Event( topic='ftrack.action.trigger-user-interface', data=dict(type='message', success=True, message='test message'), target='applicationId=ftrack.client.web and user.id="{0}"'.format( session.api_user ), ), synchronous=True, on_error='ignore', ) print("Done") session.event_hub.wait() if __name__ == "__main__": main()
Guest Posted June 17, 2020 Report Posted June 17, 2020 Hi Andriy, session.api_user is a username, not an id, so your line should instead read: target='applicationId=ftrack.client.web and user.username="{0}"'.format( Also, when setting "synchronous" to True, only the listeners registered with that specific local instance of Python (i.e. plugins whose register() methods were called when the session was created) will be notified--there is no communication across the network or even between processes. I hope that helps! Let us know if you have further questions.
Andriy Babak Posted June 20, 2020 Author Report Posted June 20, 2020 Hi Steve, Thank you, it was my stupid mistake. Now the messages are delivered fine and I've been able to launch an application using 'ftrack.action.launch'. Cheers, Andriy
Recommended Posts
Archived
This topic is now archived and is closed to further replies.