Commit Graph

52 Commits

Author SHA1 Message Date
Vinnie Falco
5521b91d8c Tidy up cmake files and examples 2019-10-06 08:04:22 -07:00
Damian Jarek
3eebf420f0 Add async-ssl-system-executor http client example
This example websocket client application uses the `system_executor` to show
how to use it with the I/O objects in ASIO and Beast.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-10-06 07:52:13 -07:00
Damian Jarek
0f5d1edcd8 Fix data race in websocket examples
When using `websocket::stream`, the user has to take care to initiate
async operations within the associated strand.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-10-06 07:52:13 -07:00
Damian Jarek
8d5bd286d7
Replace uses of net::spawn with asio::spawn
`asio::spawn` is an extension, which is not part of
the Networking TS, so the `net` alias is not appropriate in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:35 +02:00
Damian Jarek
f10dc38ae6
Replace uses of net::coroutine with asio::coroutine
`asio::coroutine` is an extension, which is not part of
the Networking TS, so the `net` alias is not appropriate in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-06-19 17:53:35 +02:00
Konstantin Podsvirov
56b5f8043f
Clean up typo in chat websocket javascript client
It so happened that the code works, because both variables exist,
but the code was not clean.

close #1620
2019-06-01 18:15:25 +02:00
Konstantin Podsvirov
e5bad9cbc2
Make chat websocket javascript client more user friendly
Close #1611
2019-05-19 22:32:44 +02:00
Vinnie Falco
4e90183bda Check defined(BOOST_MSVC) 2019-03-29 20:42:44 -07:00
Vinnie Falco
61fcd9ef6f Refactor Jamfiles to work with release layout 2019-03-24 09:18:02 -07:00
Vinnie Falco
b38901887b cmake: Use static libs to speed up builds 2019-03-23 17:50:38 -07:00
Damian Jarek
222dcf7b18 Jamfile cleanup:
- Don't set the global link settings (`<link>`) to avoid dependency
ordering issues in the future.
- Allow the user to decide on the link settings for dependencies
(filesystem/coroutine).
- Make dependencies in examples explicit.
- Remove dependency of examples on Boost.Filesystem (was not used there).
- Deduplicate build settings.
- Speed up test compilation by avoiding rebuilding of main test file.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-21 17:23:49 +01:00
Damian Jarek
05f3f8a5ce Remove the need for OpenSSL in examples that don't use it
close #1524

It is now possible to compile examples without OpenSSL. Examples that
do require OpenSSL will be omitted.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-19 06:59:55 -07:00
Damian Jarek
8869ec5681
Use secure TLS/SSL versions:
TLS1.2 can be used instead, it is available in all currently
supported versions of OpenSSL.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
2019-03-14 09:56:50 -07:00
Vinnie Falco
b51c4bb49a Tidy up examples 2019-03-06 05:40:49 -08:00
Vinnie Falco
fca4b3ae10 make_strand is in net:: 2019-03-02 07:33:57 -08:00
Vinnie Falco
272b6f23e4 Examples use flat_buffer
fix #1488
2019-03-01 12:02:28 -08:00
Vinnie Falco
8eb15148d7 Advanced servers use HTTP parser interfaces for reading 2019-02-28 10:04:52 -08:00
Vinnie Falco
8f9eed1faf stream_base::timeout::suggested is a nested function 2019-02-27 06:52:45 -08:00
Vinnie Falco
0647c902ac role_type is in boost/beast/core/role.hpp (API Change):
This enumeration is now part of the library core and
not specific to websocket.
2019-02-26 07:20:46 -08:00
Vinnie Falco
5dd01155e6 Doc work 2019-02-25 08:26:42 -08:00
Vinnie Falco
6331e03a3a OpenSSL is required for tests and examples 2019-02-23 11:15:59 -08:00
Vinnie Falco
6ada618c12 Check BOOST_NO_CXX11_THREAD_LOCAL 2019-02-21 11:09:02 -08:00
Vinnie Falco
c3c3777661 Pass strand to async_accept 2019-02-20 15:30:03 -08:00
Vinnie Falco
c5b655c954 basic_stream connects are members 2019-02-19 16:27:27 -08:00
Vinnie Falco
6baa607295 Fixes to support Asio changes (API Change):
This adjusts Beast's interfaces and implementation to match
the changes in Boost.Asio.
2019-02-19 16:23:30 -08:00
Vinnie Falco
3f50efa138 WebSocket Decorator is a socket option (API Change):
This changes the interface used to apply a decorator to the HTTP
request or response messages used to perform the WebSocket handshake
as follows:

* Add the `stream_base::decorator` option object

* Add `stream::set_option` overload to set the decorator from
  the option

* The decorator applies to all client and server handshakes
  performed on the stream after the option is set.

* Overloads of the following functions which accept a Decorator
  are deprecated:
  - accept, accept_ex
  - handshake, handshake_ex
  - async_accept, async_accept_ex
  - async_handshake, async_handshake_ex

Actions Required:

* Code which passes decorator to any `websocket::stream` member
  function should call `stream::set_option` instead with a newly
  constructed `stream_base::decorator` object containing the
  decorator. Alternatively, the macro `BOOST_BEAST_ALLOW_DEPRECATED`
  may be defined to 1.
2019-02-19 16:23:30 -08:00
Vinnie Falco
fc7b47fc5d Use suggested timeouts in Websocket examples 2019-02-18 12:18:27 -08:00
Vinnie Falco
00e8c381cd Examples use ssl_stream
fix #1455
2019-02-16 15:09:35 -08:00
Vinnie Falco
18447553ca Examples use bind_front_handler 2019-02-14 17:28:54 -08:00
Vinnie Falco
c08ce90e2c Tidy up a warning 2019-02-13 12:16:22 -08:00
Vinnie Falco
6ee1a88292 Use tcp_stream in WebSocket server examples 2019-02-10 11:42:01 -08:00
Vinnie Falco
920909673a Use tcp_stream in WebSocket client examples 2019-02-10 11:42:01 -08:00
Daniel Sewtz
cd28598e5b Fixes to rfc7230:
fix #1435, fix #1438

* Example and test can be built on msvc v141 15.9.6
  using /std:c++17 and BOOST_BEAST_USE_STD_STRING_VIEW.

* changed string_view.to_string() to std:string(string_view),
  awaiting availability of Library Fundamentals TS here.

* Reactivated relevant tests to param_list. #ifdef 0 test
  exhibited same assertion failed error in debug mode.
  Now fixed in DEBUG on msvc v141 15.9.6 with
  BOOST_BEAST_USE_STD_STRING_VIEW and /std:c++17.

* Looked up http paramters (transfer-encoding, etc.)
  and changed tests as well as fixing comment to
  match specs.
2019-02-07 17:37:18 -08:00
Vinnie Falco
bc74cc2374 Spaces not tabs 2019-02-03 17:17:03 -08:00
Vinnie Falco
6a658b5c3a Remove lowest_layer, add get_lowest_layer (API Change):
fix #1417

* New get_lowest_layer free function works for any object
* New lowest_layer_type trait works for any object
* New examples and documentation on layered streams

API Changes:

* The member function lowest_layer is removed from all
  types provided by the library:

Actions Required:

* Call the free function get_lowest_layer instead of
  member lowest_layer.
2019-02-01 04:31:13 -08:00
Vinnie Falco
383b9cb7f2 Send from the strand 2019-01-21 16:07:00 -08:00
Vinnie Falco
3081f52ad5 Add websocket-chat-multi example:
This is the multi-threaded io_context version of the
CppCon2018 WebSocket chat server and client example.
2019-01-21 12:13:04 -08:00
Vinnie Falco
0006ab3b2b make_printable replaces buffers rename (API Change):
* The function buffers is deprecated, use the new
  function make_printable as the replacement.

Actions Required:

* Replace call sites to use make_printable instead of buffers,
  and also include make_printable.hpp instead of ostream.hpp.
2018-12-19 20:59:20 -08:00
Vinnie Falco
f995fd41a3 net is a namespace alias for boost::asio:
The namespace alias beast::net replaces boost::asio in all code
and documentation.
2018-12-02 17:51:43 -08:00
cos-public
c2ecba968c Check error in example set_option
fix #1186
2018-07-12 11:07:10 -07:00
Vinnie Falco
a4714746dc Examples set reuse_address(true)
fix #1027
2018-02-21 12:35:07 -08:00
Vinnie Falco
593ccb15cd Fix teardown for TIME_WAIT
fix #1024, fix #1029
2018-02-20 04:33:43 -08:00
Vinnie Falco
dabb78afe7 Sanitizer failures are errors 2017-12-23 08:46:34 -08:00
Vinnie Falco
e39e4c73bf Rename Cmake variables for clarity 2017-10-30 12:35:56 -07:00
Vinnie Falco
42679ee0bc Tidy up project folders in CMakeLists.txt 2017-10-30 12:35:55 -07:00
Vinnie Falco
2746184850 Tidy up fast websocket server host names 2017-10-26 05:52:56 -07:00
Vinnie Falco
3a28e999af Update for Net-TS Asio (API Change):
fix #769

The following classes are removed:

* handler_type
* async_result
* async_completion
* is_dynamic_buffer
* is_const_buffer_sequence
* is_mutable_buffer_sequence
* handler_alloc

Actions Required:

* Use BOOST_ASIO_HANDLER_TYPE instead of handler_type
* Use BOOST_ASIO_INITFN_RESULT_TYPE instead of async_result
* Use boost::asio::async_completion
* Use boost::asio::is_dynamic_buffer
* Use boost::asio::is_const_buffer_sequence
* Use boost::asio::is_mutable_buffer_sequence
* boost::asio::associated_allocator_t replaces handler_alloc
2017-10-23 17:11:27 -07:00
Vinnie Falco
c0cf030528 OpenSSL targets are optional (CMake) 2017-10-01 10:34:17 -07:00
Peter Jankuliak
fa4df7eb60 Remove unused strands in server examples 2017-09-25 21:33:04 -07:00
Vinnie Falco
c0e5f14702 WebSocket writes return the bytes transferred (API Change):
* Stream write operations now return the number of bytes
transferred from the caller's input buffers.

Actions Required:

* Modify websocket write completion handlers to receive
  the extra std::size_t bytes_transferred parameter.
2017-09-03 20:05:19 -07:00