bluesky.run_engine.Dispatcher.subscribe

Dispatcher.subscribe(func, name='all')[source]

Register a callback function to consume documents.

Changed in version 0.10.0: The order of the arguments was swapped and the name argument has been given a default value, 'all'. Because the meaning of the arguments is unambiguous (they must be a callable and a string, respectively) the old order will be supported indefinitely, with a warning.

Changed in version 0.10.0: The order of the arguments was swapped and the name argument has been given a default value, 'all'. Because the meaning of the arguments is unambiguous (they must be a callable and a string, respectively) the old order will be supported indefinitely, with a warning.

Parameters
func: callable

expecting signature like f(name, document) where name is a string and document is a dict

name{‘all’, ‘start’, ‘descriptor’, ‘event’, ‘stop’}, optional

the type of document this function should receive (‘all’ by default).

Returns
tokenint

an integer ID that can be used to unsubscribe

See also

Dispatcher.unsubscribe()

an integer token that can be used to unsubscribe