mqtt_cpp
async_client.hpp
Go to the documentation of this file.
1 // Copyright Takatoshi Kondo 2015
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #if !defined(MQTT_ASYNC_CLIENT_HPP)
8 #define MQTT_ASYNC_CLIENT_HPP
9 
10 #include <mqtt/namespace.hpp>
11 #include <mqtt/client.hpp>
12 #include <mqtt/move.hpp>
14 
15 namespace MQTT_NS {
16 
17 template <typename Socket, std::size_t PacketIdBytes = 2>
18 class async_client : public client<Socket, PacketIdBytes> {
21  using constructor_access = typename base::constructor_access;
22 public:
23 
27  template<typename ... Args>
28  async_client(constructor_access, Args && ... args)
29  : async_client(std::forward<Args>(args)...)
30  { }
31 
39  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, as::io_context::strand>>>>
40  make_async_client(as::io_context& ioc, std::string host, std::string port, protocol_version version);
41 
49  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, null_strand>>>>
50  make_async_client_no_strand(as::io_context& ioc, std::string host, std::string port, protocol_version version);
51 
52 #if defined(MQTT_USE_WS)
62  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>>>>
63  make_async_client_ws(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
64 
73  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, null_strand>>>>
74  make_async_client_no_strand_ws(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
75 #endif // defined(MQTT_USE_WS)
76 
77 #if defined(MQTT_USE_TLS)
85  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>>>
86  make_tls_async_client(as::io_context& ioc, std::string host, std::string port, protocol_version version);
87 
95  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>>>
96  make_tls_async_client_no_strand(as::io_context& ioc, std::string host, std::string port, protocol_version version);
97 
98 #if defined(MQTT_USE_WS)
108  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>>>
109  make_tls_async_client_ws(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
110 
119  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>>>
120  make_tls_async_client_no_strand_ws(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
121 #endif // defined(MQTT_USE_WS)
122 #endif // defined(MQTT_USE_TLS)
123 
131  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>>>
132  make_async_client_32(as::io_context& ioc, std::string host, std::string port, protocol_version version);
133 
141  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, null_strand>, 4>>>
142  make_async_client_no_strand_32(as::io_context& ioc, std::string host, std::string port, protocol_version version);
143 
144 #if defined(MQTT_USE_WS)
154  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>>>
155  make_async_client_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
156 
165  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, null_strand>, 4>>>
166  make_async_client_no_strand_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
167 #endif // defined(MQTT_USE_WS)
168 
169 #if defined(MQTT_USE_TLS)
177  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>>>
178  make_tls_async_client_32(as::io_context& ioc, std::string host, std::string port, protocol_version version);
179 
187  friend std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>>>
188  make_tls_async_client_no_strand_32(as::io_context& ioc, std::string host, std::string port, protocol_version version);
189 
190 #if defined(MQTT_USE_WS)
200  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>>>
201  make_tls_async_client_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
202 
211  friend std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>>>
212  make_tls_async_client_no_strand_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path, protocol_version version);
213 #endif // defined(MQTT_USE_WS)
214 #endif // defined(MQTT_USE_TLS)
215 
216 
224  void set_auto_pub_response(bool b = true) {
226  }
227 
228  void connect() = delete;
229  void disconnect() = delete;
230 
231  void publish() = delete;
232  void subscribe() = delete;
233  void unsubscribe() = delete;
234  void pingresp() = delete;
235  void connack() = delete;
236  void puback() = delete;
237  void pubrec() = delete;
238  void pubrel() = delete;
239  void pubcomp() = delete;
240  void suback() = delete;
241  void unsuback() = delete;
242 
243 protected:
244  // Ensure that only code that knows the *exact* type of an object
245  // inheriting from this abstract base class can destruct it.
246  // This avoids issues of the destructor not triggering destruction
247  // of derived classes, and any member variables contained in them.
248  // Note: Not virtual to avoid need for a vtable when possible.
249  ~async_client() = default;
250 
252  as::io_context& ioc,
253  std::string host,
254  std::string port,
255 #if defined(MQTT_USE_WS)
256  std::string path = "/",
257 #endif // defined(MQTT_USE_WS)
259  ):base(ioc,
260  force_move(host),
261  force_move(port),
262 #if defined(MQTT_USE_WS)
263  force_move(path),
264 #endif // defined(MQTT_USE_WS)
265  version,
266  true
267  ) {
270  }
271 };
272 
273 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, as::io_context::strand>>>>
274 make_async_client(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
276  return std::make_shared<callable_overlay<async_client_t>>(
277  async_client_t::constructor_access(),
278  ioc,
279  force_move(host),
280  force_move(port),
281 #if defined(MQTT_USE_WS)
282  "/",
283 #endif // defined(MQTT_USE_WS)
284  version
285  );
286 }
287 
288 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, as::io_context::strand>>>>
289 make_async_client(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
290  return make_async_client(
291  ioc,
292  force_move(host),
293  std::to_string(port),
294  version
295  );
296 }
297 
298 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, null_strand>>>>
299 make_async_client_no_strand(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
301  return std::make_shared<callable_overlay<async_client_t>>(
302  async_client_t::constructor_access(),
303  ioc,
304  force_move(host),
305  force_move(port),
306 #if defined(MQTT_USE_WS)
307  "/",
308 #endif // defined(MQTT_USE_WS)
309  version
310  );
311 }
312 
313 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, null_strand>>>>
314 make_async_client_no_strand(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
316  ioc,
317  force_move(host),
318  std::to_string(port),
319  version
320  );
321 }
322 
323 #if defined(MQTT_USE_WS)
324 
325 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>>>>
326 make_async_client_ws(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
327  using async_client_t = async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>>;
328  return std::make_shared<callable_overlay<async_client_t>>(
329  async_client_t::constructor_access(),
330  ioc,
331  force_move(host),
332  force_move(port),
333  force_move(path),
334  version
335  );
336 }
337 
338 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>>>>
339 make_async_client_ws(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
340  return make_async_client_ws(
341  ioc,
342  force_move(host),
343  std::to_string(port),
344  force_move(path),
345  version
346  );
347 }
348 
349 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, null_strand>>>>
350 make_async_client_no_strand_ws(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
351  using async_client_t = async_client<ws_endpoint<as::ip::tcp::socket, null_strand>>;
352  return std::make_shared<callable_overlay<async_client_t>>(
353  async_client_t::constructor_access(),
354  ioc,
355  force_move(host),
356  force_move(port),
357  force_move(path),
358  version
359  );
360 }
361 
362 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, null_strand>>>>
363 make_async_client_no_strand_ws(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
364  return make_async_client_no_strand_ws(
365  ioc,
366  force_move(host),
367  std::to_string(port),
368  force_move(path),
369  version
370  );
371 }
372 
373 #endif // defined(MQTT_USE_WS)
374 
375 #if defined(MQTT_USE_TLS)
376 
377 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>>>
378 make_tls_async_client(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
379  using async_client_t = async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>;
380  return std::make_shared<callable_overlay<async_client_t>>(
381  async_client_t::constructor_access(),
382  ioc,
383  force_move(host),
384  force_move(port),
385 #if defined(MQTT_USE_WS)
386  "/",
387 #endif // defined(MQTT_USE_WS)
388  version
389  );
390 }
391 
392 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>>>
393 make_tls_async_client(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
394  return make_tls_async_client(
395  ioc,
396  force_move(host),
397  std::to_string(port),
398  version
399  );
400 }
401 
402 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>>>
403 make_tls_async_client_no_strand(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
404  using async_client_t = async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>;
405  return std::make_shared<callable_overlay<async_client_t>>(
406  async_client_t::constructor_access(),
407  ioc,
408  force_move(host),
409  force_move(port),
410 #if defined(MQTT_USE_WS)
411  "/",
412 #endif // defined(MQTT_USE_WS)
413  version
414  );
415 }
416 
417 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>>>
418 make_tls_async_client_no_strand(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
419  return make_tls_async_client_no_strand(
420  ioc,
421  force_move(host),
422  std::to_string(port),
423  version
424  );
425 }
426 
427 #if defined(MQTT_USE_WS)
428 
429 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>>>
430 make_tls_async_client_ws(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
431  using async_client_t = async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>;
432  return std::make_shared<callable_overlay<async_client_t>>(
433  async_client_t::constructor_access(),
434  ioc,
435  force_move(host),
436  force_move(port),
437  force_move(path),
438  version
439  );
440 }
441 
442 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>>>>
443 make_tls_async_client_ws(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
444  return make_tls_async_client_ws(
445  ioc,
446  force_move(host),
447  std::to_string(port),
448  force_move(path),
449  version
450  );
451 }
452 
453 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>>>
454 make_tls_async_client_no_strand_ws(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
455  using async_client_t = async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>;
456  return std::make_shared<callable_overlay<async_client_t>>(
457  async_client_t::constructor_access(),
458  ioc,
459  force_move(host),
460  force_move(port),
461  force_move(path),
462  version
463  );
464 }
465 
466 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>>>>
467 make_tls_async_client_no_strand_ws(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
468  return make_tls_async_client_no_strand_ws(
469  ioc,
470  force_move(host),
471  std::to_string(port),
472  force_move(path),
473  version
474  );
475 }
476 
477 #endif // defined(MQTT_USE_WS)
478 
479 #endif // defined(MQTT_USE_TLS)
480 
481 
482 // 32bit Packet Id (experimental)
483 
484 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>>>
485 make_async_client_32(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
487  return std::make_shared<callable_overlay<async_client_t>>(
488  async_client_t::constructor_access(),
489  ioc,
490  force_move(host),
491  force_move(port),
492 #if defined(MQTT_USE_WS)
493  "/",
494 #endif // defined(MQTT_USE_WS)
495  version
496  );
497 }
498 
499 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>>>
500 make_async_client_32(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
501  return make_async_client_32(
502  ioc,
503  force_move(host),
504  std::to_string(port),
505  version
506  );
507 }
508 
509 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, null_strand>, 4>>>
510 make_async_client_no_strand_32(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
512  return std::make_shared<callable_overlay<async_client_t>>(
513  async_client_t::constructor_access(),
514  ioc,
515  force_move(host),
516  force_move(port),
517 #if defined(MQTT_USE_WS)
518  "/",
519 #endif // defined(MQTT_USE_WS)
520  version
521  );
522 }
523 
524 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<as::ip::tcp::socket, null_strand>, 4>>>
525 make_async_client_no_strand_32(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
527  ioc,
528  force_move(host),
529  std::to_string(port),
530  version
531  );
532 }
533 
534 #if defined(MQTT_USE_WS)
535 
536 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>>>
537 make_async_client_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
538  using async_client_t = async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>;
539  return std::make_shared<callable_overlay<async_client_t>>(
540  async_client_t::constructor_access(),
541  ioc,
542  force_move(host),
543  force_move(port),
544  force_move(path),
545  version
546  );
547 }
548 
549 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, as::io_context::strand>, 4>>>
550 make_async_client_ws_32(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
551  return make_async_client_ws_32(
552  ioc,
553  force_move(host),
554  std::to_string(port),
555  force_move(path),
556  version
557  );
558 }
559 
560 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, null_strand>, 4>>>
561 make_async_client_no_strand_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
562  using async_client_t = async_client<ws_endpoint<as::ip::tcp::socket, null_strand>, 4>;
563  return std::make_shared<callable_overlay<async_client_t>>(
564  async_client_t::constructor_access(),
565  ioc,
566  force_move(host),
567  force_move(port),
568  force_move(path),
569  version
570  );
571 }
572 
573 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<as::ip::tcp::socket, null_strand>, 4>>>
574 make_async_client_no_strand_ws_32(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
575  return make_async_client_no_strand_ws_32(
576  ioc,
577  force_move(host),
578  std::to_string(port),
579  force_move(path),
580  version
581  );
582 }
583 
584 #endif // defined(MQTT_USE_WS)
585 
586 #if defined(MQTT_USE_TLS)
587 
588 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>>>
589 make_tls_async_client_32(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
590  using async_client_t = async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>;
591  return std::make_shared<callable_overlay<async_client_t>>(
592  async_client_t::constructor_access(),
593  ioc,
594  force_move(host),
595  force_move(port),
596 #if defined(MQTT_USE_WS)
597  "/",
598 #endif // defined(MQTT_USE_WS)
599  version
600  );
601 }
602 
603 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>>>
604 make_tls_async_client_32(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
605  return make_tls_async_client_32(
606  ioc,
607  force_move(host),
608  std::to_string(port),
609  version
610  );
611 }
612 
613 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>>>
614 make_tls_async_client_no_strand_32(as::io_context& ioc, std::string host, std::string port, protocol_version version = protocol_version::v3_1_1) {
615  using async_client_t = async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>;
616  return std::make_shared<callable_overlay<async_client_t>>(
617  async_client_t::constructor_access(),
618  ioc,
619  force_move(host),
620  force_move(port),
621 #if defined(MQTT_USE_WS)
622  "/",
623 #endif // defined(MQTT_USE_WS)
624  version
625  );
626 }
627 
628 inline std::shared_ptr<callable_overlay<async_client<tcp_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>>>
629 make_tls_async_client_no_strand_32(as::io_context& ioc, std::string host, std::uint16_t port, protocol_version version = protocol_version::v3_1_1) {
630  return make_tls_async_client_no_strand_32(
631  ioc,
632  force_move(host),
633  std::to_string(port),
634  version
635  );
636 }
637 
638 #if defined(MQTT_USE_WS)
639 
640 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>>>
641 make_tls_async_client_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
642  using async_client_t = async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>;
643  return std::make_shared<callable_overlay<async_client_t>>(
644  async_client_t::constructor_access(),
645  ioc,
646  force_move(host),
647  force_move(port),
648  force_move(path),
649  version
650  );
651 }
652 
653 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, as::io_context::strand>, 4>>>
654 make_tls_async_client_ws_32(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
655  return make_tls_async_client_ws_32(
656  ioc,
657  force_move(host),
658  std::to_string(port),
659  force_move(path),
660  version
661  );
662 }
663 
664 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>>>
665 make_tls_async_client_no_strand_ws_32(as::io_context& ioc, std::string host, std::string port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
666  using async_client_t = async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>;
667  return std::make_shared<callable_overlay<async_client_t>>(
668  async_client_t::constructor_access(),
669  ioc,
670  force_move(host),
671  force_move(port),
672  force_move(path),
673  version
674  );
675 }
676 
677 inline std::shared_ptr<callable_overlay<async_client<ws_endpoint<tls::stream<as::ip::tcp::socket>, null_strand>, 4>>>
678 make_tls_async_client_no_strand_ws_32(as::io_context& ioc, std::string host, std::uint16_t port, std::string path = "/", protocol_version version = protocol_version::v3_1_1) {
679  return make_tls_async_client_no_strand_ws_32(
680  ioc,
681  force_move(host),
682  std::to_string(port),
683  force_move(path),
684  version
685  );
686 }
687 
688 #endif // defined(MQTT_USE_WS)
689 
690 #endif // defined(MQTT_USE_TLS)
691 
692 } // namespace MQTT_NS
693 
694 #endif // MQTT_ASYNC_CLIENT_HPP
Definition: async_client.hpp:18
async_client(constructor_access, Args &&... args)
Definition: async_client.hpp:28
void pubrel()=delete
void unsubscribe()=delete
friend std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, as::io_context::strand > > > > make_async_client(as::io_context &ioc, std::string host, std::string port, protocol_version version)
Create no tls async_client with strand.
Definition: async_client.hpp:274
void suback()=delete
void pubrec()=delete
void publish()=delete
void subscribe()=delete
async_client(as::io_context &ioc, std::string host, std::string port, protocol_version version=protocol_version::v3_1_1)
Definition: async_client.hpp:251
void unsuback()=delete
friend std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, as::io_context::strand >, 4 > > > make_async_client_32(as::io_context &ioc, std::string host, std::string port, protocol_version version)
Create no tls async_client with strand.
Definition: async_client.hpp:485
friend std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, null_strand > > > > make_async_client_no_strand(as::io_context &ioc, std::string host, std::string port, protocol_version version)
Create no tls async_client without strand.
Definition: async_client.hpp:299
void disconnect()=delete
void set_auto_pub_response(bool b=true)
Set auto publish response mode.
Definition: async_client.hpp:224
void connect()=delete
void puback()=delete
void pubcomp()=delete
friend std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, null_strand >, 4 > > > make_async_client_no_strand_32(as::io_context &ioc, std::string host, std::string port, protocol_version version)
Create no tls async_client without strand.
Definition: async_client.hpp:510
void pingresp()=delete
void connack()=delete
Definition: client.hpp:36
void set_async_pingreq(bool b)
Set pingreq message sending mode.
Definition: client.hpp:932
void set_auto_pub_response(bool b=true, bool async=true)
Set auto publish response mode.
Definition: endpoint.hpp:855
Definition: any.hpp:27
std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, as::io_context::strand > > > > make_async_client(as::io_context &ioc, std::string host, std::string port, protocol_version version=protocol_version::v3_1_1)
Definition: async_client.hpp:274
constexpr std::remove_reference_t< T > && force_move(T &&t)
Definition: move.hpp:20
std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, null_strand > > > > make_async_client_no_strand(as::io_context &ioc, std::string host, std::string port, protocol_version version=protocol_version::v3_1_1)
Definition: async_client.hpp:299
protocol_version
Definition: protocol_version.hpp:17
std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, as::io_context::strand >, 4 > > > make_async_client_32(as::io_context &ioc, std::string host, std::string port, protocol_version version=protocol_version::v3_1_1)
Definition: async_client.hpp:485
std::shared_ptr< callable_overlay< async_client< tcp_endpoint< as::ip::tcp::socket, null_strand >, 4 > > > make_async_client_no_strand_32(as::io_context &ioc, std::string host, std::string port, protocol_version version=protocol_version::v3_1_1)
Definition: async_client.hpp:510
Definition: client.hpp:40
Definition: null_strand.hpp:20