• 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 #include <boost/config.hpp>
11 
12 #ifdef BOOST_MSVC
13 #pragma warning(push)
14 #pragma warning(disable: 4459) // declaration hides global declaration
15 #endif
16 
17 #include <boost/beast/_experimental/unit_test/suite.hpp>
18 
19 #include <boost/beast.hpp>
20 #include <boost/beast/ssl.hpp>
21 #include <boost/asio.hpp>
22 #include <boost/asio/ssl.hpp>
23 
24 namespace {
25 
26 #include "websocket_common.ipp"
27 
28 void
snippets()29 snippets()
30 {
31     stream<tcp_stream> ws(ioc);
32 
33     {
34     //[code_websocket_5_1
35 
36         ws.control_callback(
37             [](frame_type kind, string_view payload)
38             {
39                 // Do something with the payload
40                 boost::ignore_unused(kind, payload);
41             });
42 
43     //]
44     }
45 
46     {
47     //[code_websocket_5_2
48 
49         ws.close(close_code::normal);
50 
51     //]
52     }
53 
54     {
55     //[code_websocket_5_3
56 
57         ws.auto_fragment(true);
58         ws.write_buffer_bytes(16384);
59 
60     //]
61     }
62 }
63 
64 struct websocket_5_test
65     : public boost::beast::unit_test::suite
66 {
67     void
run__anonea88ed4c0111::websocket_5_test68     run() override
69     {
70         BEAST_EXPECT(&snippets);
71     }
72 };
73 
74 BEAST_DEFINE_TESTSUITE(beast,doc,websocket_5);
75 
76 } // (anon)
77 
78 #ifdef BOOST_MSVC
79 #pragma warning(pop)
80 #endif
81