2 // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // Official repository: https://github.com/boostorg/beast
10 #ifndef BOOST_BEAST_WEBSOCKET_ROLE_HPP
11 #define BOOST_BEAST_WEBSOCKET_ROLE_HPP
13 #include <boost/beast/core/detail/config.hpp>
19 /** The role of the websocket stream endpoint.
21 Whether the endpoint is a client or server affects the
22 behavior of the <em>Close the WebSocket Connection</em>
23 operation described in rfc6455 section 7.1.1.
24 The shutdown behavior depends on the type of the next
25 layer template parameter used to construct the @ref stream.
26 Other next layer types including user-defined types
27 may implement different role-based behavior when
28 performing the close operation.
30 The default implementation for @ref stream when the next
31 layer type is a `boost::asio::ip::tcp::socket` behaves
34 @li In the client role, a TCP/IP shutdown is sent after
35 reading all remaining data on the connection.
37 @li In the server role, a TCP/IP shutdown is sent before
38 reading all remaining data on the connection.
40 When the next layer type is a `boost::asio::ssl::stream`,
41 the connection is closed by performing the SSL closing
42 handshake corresponding to the role type, client or server.
44 @see https://tools.ietf.org/html/rfc6455#section-7.1.1
48 /// The stream is operating as a client.
51 /// The stream is operating as a server.