diff --git a/example/ep_cpp20coro_mqtt_client.cpp b/example/ep_cpp20coro_mqtt_client.cpp index 753f19b98..4e012b90e 100644 --- a/example/ep_cpp20coro_mqtt_client.cpp +++ b/example/ep_cpp20coro_mqtt_client.cpp @@ -14,9 +14,9 @@ namespace as = boost::asio; namespace am = async_mqtt; -template as::awaitable -proc(Executor exe, std::string_view host, std::string_view port) { +proc(std::string_view host, std::string_view port) { + auto exe = co_await as::this_coro::executor; as::ip::tcp::socket resolve_sock{exe}; as::ip::tcp::resolver res{exe}; auto amep = am::endpoint::create( @@ -183,6 +183,6 @@ int main(int argc, char* argv[]) { return -1; } as::io_context ioc; - as::co_spawn(ioc, proc(ioc.get_executor(), argv[1], argv[2]), as::detached); + as::co_spawn(ioc.get_executor(), proc(argv[1], argv[2]), as::detached); ioc.run(); } diff --git a/include/async_mqtt/predefined_underlying_layer.hpp b/include/async_mqtt/predefined_underlying_layer.hpp index 0d560ad82..4e18c46b7 100644 --- a/include/async_mqtt/predefined_underlying_layer.hpp +++ b/include/async_mqtt/predefined_underlying_layer.hpp @@ -24,13 +24,20 @@ namespace protocol { /** * @breif Type alias of Boost.Asio TCP socket */ -using mqtt = as::basic_stream_socket; +using mqtt = as::basic_stream_socket; #if defined(ASYNC_MQTT_USE_WS) + +namespace detail { + +using mqtt_beast_workaround = as::basic_stream_socket; + +} // namespace detail + /** * @breif Type alias of Boost.Beast WebScoket */ -using ws = bs::websocket::stream; +using ws = bs::websocket::stream; #endif //defined(ASYNC_MQTT_USE_WS) } // namespace procotol @@ -49,10 +56,17 @@ namespace protocol { using mqtts = tls::stream; #if defined(ASYNC_MQTT_USE_WS) + +namespace detail { + +using mqtts_beast_workaround = tls::stream; + +} // namespace detail + /** * @breif Type alias of Boost.Beast WebSocket on TLS stream */ -using wss = bs::websocket::stream; +using wss = bs::websocket::stream; #endif // defined(ASYNC_MQTT_USE_WS)