mqtt_cpp icon indicating copy to clipboard operation
mqtt_cpp copied to clipboard

Client sample out of main scope

Open codesian opened this issue 1 year ago • 1 comments

Hi, a begginer here.

There is an example about client use out of main scope? How to store on a class member, something more generic than shot and close on main?

Thanks!

codesian avatar May 03 '23 11:05 codesian

See bench.cpp https://github.com/redboltz/mqtt_cpp/blob/27765791adaede2ce5340f81405ad6304387b12d/example/bench.cpp#L1054-L1070

It is a little tricky because mqtt_cpp supports various underlying layer without virtual function mechanism to support templates. So we need to use decltype() to get the type information.

redboltz avatar May 03 '23 13:05 redboltz