1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>websocket::async_teardown (2 of 2 overloads)</title> 5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Beast"> 8<link rel="up" href="../boost__beast__websocket__async_teardown.html" title="websocket::async_teardown"> 9<link rel="prev" href="overload1.html" title="websocket::async_teardown (1 of 2 overloads)"> 10<link rel="next" href="../boost__beast__zlib__error.html" title="zlib::error"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="overload1.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__websocket__async_teardown.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost__beast__zlib__error.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="beast.ref.boost__beast__websocket__async_teardown.overload2"></a><a class="link" href="overload2.html" title="websocket::async_teardown (2 of 2 overloads)">websocket::async_teardown 28 (2 of 2 overloads)</a> 29</h5></div></div></div> 30<p> 31 Start tearing down a <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code>. 32 </p> 33<h6> 34<a name="beast.ref.boost__beast__websocket__async_teardown.overload2.h0"></a> 35 <span class="phrase"><a name="beast.ref.boost__beast__websocket__async_teardown.overload2.synopsis"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__websocket__async_teardown.overload2.synopsis">Synopsis</a> 36 </h6> 37<p> 38 Defined in header <code class="literal"><<a href="../../../../../../../boost/beast/websocket/teardown.hpp" target="_top">boost/beast/websocket/teardown.hpp</a>></code> 39 </p> 40<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 41 <span class="keyword">class</span> <a href="../../../../../../../doc/html/boost_asio/reference/Protocol.html" target="_top"><span class="emphasis"><em>Protocol</em></span></a><span class="special">,</span> 42 <span class="keyword">class</span> <a href="../../../../../../../doc/html/boost_asio/reference/Executor1.html" target="_top"><span class="emphasis"><em>Executor</em></span></a><span class="special">,</span> 43 <span class="keyword">class</span> <span class="identifier">TeardownHandler</span><span class="special">></span> 44<span class="keyword">void</span> 45<span class="identifier">async_teardown</span><span class="special">(</span> 46 <span class="identifier">role_type</span> <span class="identifier">role</span><span class="special">,</span> 47 <span class="identifier">net</span><span class="special">::</span><span class="identifier">basic_stream_socket</span><span class="special"><</span> <span class="identifier">Protocol</span><span class="special">,</span> <span class="identifier">Executor</span> <span class="special">>&</span> <span class="identifier">socket</span><span class="special">,</span> 48 <span class="identifier">TeardownHandler</span><span class="special">&&</span> <span class="identifier">handler</span><span class="special">);</span> 49</pre> 50<h6> 51<a name="beast.ref.boost__beast__websocket__async_teardown.overload2.h1"></a> 52 <span class="phrase"><a name="beast.ref.boost__beast__websocket__async_teardown.overload2.description"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__websocket__async_teardown.overload2.description">Description</a> 53 </h6> 54<p> 55 This begins tearing down a connection asynchronously. The implementation 56 will call the overload of this function based on the <code class="computeroutput"><span class="identifier">Stream</span></code> 57 parameter used to consruct the socket. When <code class="computeroutput"><span class="identifier">Stream</span></code> 58 is a user defined type, and not a <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code> 59 or any <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span></code>, callers are responsible for providing 60 a suitable overload of this function. 61 </p> 62<h6> 63<a name="beast.ref.boost__beast__websocket__async_teardown.overload2.h2"></a> 64 <span class="phrase"><a name="beast.ref.boost__beast__websocket__async_teardown.overload2.parameters"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__websocket__async_teardown.overload2.parameters">Parameters</a> 65 </h6> 66<div class="informaltable"><table class="table"> 67<colgroup> 68<col> 69<col> 70</colgroup> 71<thead><tr> 72<th> 73 <p> 74 Name 75 </p> 76 </th> 77<th> 78 <p> 79 Description 80 </p> 81 </th> 82</tr></thead> 83<tbody> 84<tr> 85<td> 86 <p> 87 <code class="computeroutput"><span class="identifier">role</span></code> 88 </p> 89 </td> 90<td> 91 <p> 92 The role of the local endpoint 93 </p> 94 </td> 95</tr> 96<tr> 97<td> 98 <p> 99 <code class="computeroutput"><span class="identifier">socket</span></code> 100 </p> 101 </td> 102<td> 103 <p> 104 The socket to tear down. 105 </p> 106 </td> 107</tr> 108<tr> 109<td> 110 <p> 111 <code class="computeroutput"><span class="identifier">handler</span></code> 112 </p> 113 </td> 114<td> 115 <p> 116 The completion handler to invoke when the operation completes. 117 The implementation takes ownership of the handler by performing 118 a decay-copy. The equivalent function signature of the handler 119 must be: 120 </p> 121<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span> 122 <span class="identifier">error_code</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">error</span> <span class="comment">// result of operation</span> 123<span class="special">);</span> 124</pre> 125 </td> 126</tr> 127</tbody> 128</table></div> 129<p> 130 Regardless of whether the asynchronous operation completes immediately 131 or not, the handler will not be invoked from within this function. Invocation 132 of the handler will be performed in a manner equivalent to using <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">post</span></code>. 133 </p> 134</div> 135<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 136<td align="left"></td> 137<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie 138 Falco<p> 139 Distributed under the Boost Software License, Version 1.0. (See accompanying 140 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 141 </p> 142</div></td> 143</tr></table> 144<hr> 145<div class="spirit-nav"> 146<a accesskey="p" href="overload1.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__websocket__async_teardown.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost__beast__zlib__error.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 147</div> 148</body> 149</html> 150