• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>websocket::stream::close (1 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="../close.html" title="websocket::stream::close">
9<link rel="prev" href="../close.html" title="websocket::stream::close">
10<link rel="next" href="overload2.html" title="websocket::stream::close (2 of 2 overloads)">
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="../close.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../close.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="overload2.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h6 class="title">
27<a name="beast.ref.boost__beast__websocket__stream.close.overload1"></a><a class="link" href="overload1.html" title="websocket::stream::close (1 of 2 overloads)">websocket::stream::close
28          (1 of 2 overloads)</a>
29</h6></div></div></div>
30<p>
31            Send a websocket close control frame.
32          </p>
33<h7><a name="beast.ref.boost__beast__websocket__stream.close.overload1.h0"></a>
34            <span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.close.overload1.synopsis"></a></span><a class="link" href="overload1.html#beast.ref.boost__beast__websocket__stream.close.overload1.synopsis">Synopsis</a>
35          </h7><pre class="programlisting"><span class="keyword">void</span>
36<span class="identifier">close</span><span class="special">(</span>
37    <span class="identifier">close_reason</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">cr</span><span class="special">);</span>
38</pre>
39<h7><a name="beast.ref.boost__beast__websocket__stream.close.overload1.h1"></a>
40            <span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.close.overload1.description"></a></span><a class="link" href="overload1.html#beast.ref.boost__beast__websocket__stream.close.overload1.description">Description</a>
41          </h7><p>
42            This function is used to send a <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1" target="_top">close
43            frame</a>, which begins the websocket closing handshake. The session
44            ends when both ends of the connection have sent and received a close
45            frame. The call blocks until one of the following conditions is true:
46          </p>
47<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
48<li class="listitem">
49                The close frame is written.
50              </li>
51<li class="listitem">
52                An error occurs.
53              </li>
54</ul></div>
55<p>
56            The algorithm, known as a <span class="emphasis"><em>composed operation</em></span>, is
57            implemented in terms of calls to the next layer's <code class="computeroutput"><span class="identifier">write_some</span></code>
58            function. After beginning the closing handshake, the program should not
59            write further message data, pings, or pongs. Instead, the program should
60            continue reading message data until an error occurs. A read returning
61            <a class="link" href="../../boost__beast__websocket__error.html" title="websocket::error"><code class="computeroutput"><span class="identifier">error</span><span class="special">::</span><span class="identifier">closed</span></code></a> indicates a successful
62            connection closure.
63          </p>
64<h7><a name="beast.ref.boost__beast__websocket__stream.close.overload1.h2"></a>
65            <span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.close.overload1.parameters"></a></span><a class="link" href="overload1.html#beast.ref.boost__beast__websocket__stream.close.overload1.parameters">Parameters</a>
66          </h7><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><tr>
84<td>
85                    <p>
86                      <code class="computeroutput"><span class="identifier">cr</span></code>
87                    </p>
88                  </td>
89<td>
90                    <p>
91                      The reason for the close. If the close reason specifies a close
92                      code other than beast::websocket::close_code::none, the close
93                      frame is sent with the close code and optional reason string.
94                      Otherwise, the close frame is sent with no payload.
95                    </p>
96                  </td>
97</tr></tbody>
98</table></div>
99<h7><a name="beast.ref.boost__beast__websocket__stream.close.overload1.h3"></a>
100            <span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.close.overload1.exceptions"></a></span><a class="link" href="overload1.html#beast.ref.boost__beast__websocket__stream.close.overload1.exceptions">Exceptions</a>
101          </h7><div class="informaltable"><table class="table">
102<colgroup>
103<col>
104<col>
105</colgroup>
106<thead><tr>
107<th>
108                    <p>
109                      Type
110                    </p>
111                  </th>
112<th>
113                    <p>
114                      Thrown On
115                    </p>
116                  </th>
117</tr></thead>
118<tbody><tr>
119<td>
120                    <p>
121                      <code class="computeroutput"><span class="identifier">system_error</span></code>
122                    </p>
123                  </td>
124<td>
125                    <p>
126                      Thrown on failure.
127                    </p>
128                  </td>
129</tr></tbody>
130</table></div>
131<h7><a name="beast.ref.boost__beast__websocket__stream.close.overload1.h4"></a>
132            <span class="phrase"><a name="beast.ref.boost__beast__websocket__stream.close.overload1.see_also"></a></span><a class="link" href="overload1.html#beast.ref.boost__beast__websocket__stream.close.overload1.see_also">See
133            Also</a>
134          </h7><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
135                <a href="https://tools.ietf.org/html/rfc6455#section-7.1.2" target="_top">Websocket
136                Closing Handshake (RFC6455)</a>
137              </li></ul></div>
138</div>
139<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
140<td align="left"></td>
141<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie
142      Falco<p>
143        Distributed under the Boost Software License, Version 1.0. (See accompanying
144        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>)
145      </p>
146</div></td>
147</tr></table>
148<hr>
149<div class="spirit-nav">
150<a accesskey="p" href="../close.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../close.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="overload2.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
151</div>
152</body>
153</html>
154