mqtt: rework to avoid scheme callbacks in library threads