Event Subscription

Subscribing to asynchronous event pushes from the server.

ti_set_event_callback

Register the server event callback.

Must be called before ti_start_event_subscription(). Starting the event subscription without a registered callback has no effect.

  • client: Client handle.
  • callback: Event callback function. Pass NULL to unregister.
  • user_data: User-defined data, passed through unchanged to the callback. May be NULL.

Note: The callback runs on the internal event thread; make sure it is thread-safe. See also: ti_event_callback_t See also: ti_start_event_subscription()

ti_stop_event_subscription

Stop the event subscription.

Safely closes the event stream and waits for the internal thread to exit; blocks until the thread has fully exited. Calling it when the subscription was not started is safe (no-op).

  • client: Client handle.
  • Returns: TI_OK — stopped successfully
  • Returns: TI_ERR_INVALID_ARG — client is NULL

See also: ti_start_event_subscription()