API referenceVetraGlove ProPython

Data subscriptions

Channels & subscriptions

Current version · 2.0.0

Returned by subscribe() to represent a callback subscription. Closing the owning scope reclaims remaining subscriptions.

Subscription.unsubscribe()

Stops one callback early.

Type

Subscription.unsubscribe() -> None

Returns

None.

Details

  • Call conditions: When the SDK keeps running but the callback is no longer needed.
  • Use only to stop a callback early. Do not synchronously unsubscribe from inside that subscription’s own callback.

Errors

  • Synchronous unsubscription inside the callback is not safe.

Example

channel is an existing read channel whose device has started, and on_sample is an application callback. Stop early from the application thread, not synchronously from inside this subscription’s own callback.

import time

subscription = channel.subscribe(on_sample)
time.sleep(0.5)
subscription.unsubscribe()

Complete example: subscription_config.py.