bluesky_queueserver.ReceiveConsoleOutputAsync.set_callback

ReceiveConsoleOutputAsync.set_callback(cb)[source]

Set callback function, which is called once for each received message. If cb is a function, it is called immediately and execution of the loop is blocked until the execution of the function is complete. If cb is coroutine, it is not awaited, but instead placed in the loop using asyncio.ensure_future. Only one callback function can be set.

Parameters:
cbcallable, coroutine or None

Reference to a callback function or coroutine. The function signature is expected to receive a message as a parameter (message is a dictionary with keys time and msg) and return None. The function is expected to handle exceptions that are raised internally. Pass None to clear callback (messages will be received and discarded).