Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

websocket::role_type
PrevUpHomeNext

The role of the websocket stream endpoint.

Synopsis

Defined in header <boost/beast/websocket/role.hpp>

enum role_type

Values

Name

Description

client

The stream is operating as a client.

server

The stream is operating as a server.

Description

Whether the endpoint is a client or server affects the behavior of the Close the WebSocket Connection operation described in rfc6455 section 7.1.1. The shutdown behavior depends on the type of the next layer template parameter used to construct the websocket::stream. Other next layer types including user-defined types may implement different role-based behavior when performing the close operation.

The default implementation for websocket::stream when the next layer type is a boost::asio::ip::tcp::socket behaves as follows:

  • In the client role, a TCP/IP shutdown is sent after reading all remaining data on the connection.
  • In the server role, a TCP/IP shutdown is sent before reading all remaining data on the connection.

When the next layer type is a boost::asio::ssl::stream, the connection is closed by performing the SSL closing handshake corresponding to the role type, client or server.

See Also

https://tools.ietf.org/html/rfc6455#section-7.1.1

Convenience header <boost/beast/websocket.hpp>


PrevUpHomeNext