• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3
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)
6
7    Official repository: https://github.com/boostorg/beast
8]
9
10[section:establishing_connections Connecting]
11
12Before messages can be exchanged, a websocket stream first needs to be
13connected, and then to have the websocket handshake performed. The stream
14delegates the task of establishing the connection to the next layers.
15For example, if the next layer is a connectible stream or socket object,
16it can be accessed to call the necessary function for connecting.
17Here we make an outbound connection as a client would do.
18
19[code_websocket_1_1]
20
21To accept incoming connections, an acceptor is used. The websocket stream
22may be constructed from the socket returned by the acceptor when an
23incoming connection is established.
24
25[code_websocket_1_2]
26
27Alternatively, the incoming connection may be accepted directly into
28the socket owned by the websocket stream, using this overload of the
29acceptor member function.
30
31[code_websocket_1_3]
32
33[endsect]
34