Jump to content

How to check connecting to server completed before publising events ?


YuChen

Recommended Posts

Hi all,

I wonder if there's any sesssion attribute I can use for checking connection to server have been made. "wait" function trick works, but I think there should be an elegant solution :) 

session = ftrack_api.Session(auto_connect_event_hub=True)
session.event_hub.subscribe('topic=custom.test_event1', my_callback)
custom_event = ftrack+api.event.base.Event(topic='custom.test_event1', data={})
session.event_hub.wait(duration=5)    # Given enough time to connect to server
session.event_hub.publish(custom_event)
session.event_hub.wait(duration=5)    # Given enough time to recieve the callback result

Any suggestion ?

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...