2016-09-25 11:19:51 -04:00
|
|
|
[/
|
2017-02-06 20:07:03 -05:00
|
|
|
Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2016-09-25 11:19:51 -04:00
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
]
|
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section Quick Start]
|
2017-06-12 19:16:39 -07:00
|
|
|
[block'''<?dbhtml stop-chunking?>''']
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-19 20:03:05 -07:00
|
|
|
These complete programs are intended to quickly impress upon readers
|
|
|
|
the flavor of the library. Source code and build scripts for them are
|
|
|
|
located in the example/ directory.
|
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[section HTTP Client]
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-04 17:25:55 -07:00
|
|
|
Use HTTP to make a GET request to a website and print the response:
|
|
|
|
|
2017-06-14 20:26:44 -07:00
|
|
|
File: [repo_file example/http-client/http_client.cpp]
|
|
|
|
|
|
|
|
[example_http_client]
|
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
2017-06-04 17:25:55 -07:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section WebSocket Client]
|
2017-06-04 17:25:55 -07:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
Establish a WebSocket connection, send a message and receive the reply:
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
File: [repo_file example/websocket-client/websocket_client.cpp]
|
2017-06-04 17:25:55 -07:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[example_websocket_client]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[endsect]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
2017-06-04 17:25:55 -07:00
|
|
|
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-01-30 09:53:10 -05:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section Examples]
|
|
|
|
[block'''<?dbhtml stop-chunking?>''']
|
|
|
|
|
2017-06-19 20:03:05 -07:00
|
|
|
Source code and build scripts for these programs are located
|
|
|
|
in the example/ directory.
|
2017-06-16 19:27:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[section HTTP Crawl]
|
2017-01-30 09:53:10 -05:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
This example retrieves the page at each of the most popular domains
|
|
|
|
as measured by Alexa.
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
* [repo_file example/http-crawl/http_crawl.cpp]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
2017-01-30 09:53:10 -05:00
|
|
|
|
2016-10-02 16:42:50 -04:00
|
|
|
|
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section HTTP Client (with SSL)]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
This example demonstrates sending and receiving HTTP messages
|
|
|
|
over a TLS connection. Requires OpenSSL to build.
|
2016-10-02 16:42:50 -04:00
|
|
|
|
2017-06-18 17:10:38 -07:00
|
|
|
* [repo_file example/http-client-ssl/http_client_ssl.cpp]
|
2016-10-02 16:33:42 -04:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
2016-10-02 16:33:42 -04:00
|
|
|
|
2017-06-14 20:26:44 -07:00
|
|
|
|
|
|
|
|
2017-06-23 18:23:55 -07:00
|
|
|
[section HTTP Server (Fast)]
|
2017-06-23 01:44:25 -07:00
|
|
|
|
|
|
|
This example implements a very simple HTTP server with
|
|
|
|
some optimizations suitable for calculating benchmarks.
|
|
|
|
|
2017-06-24 12:45:38 -07:00
|
|
|
* [repo_file example/http-server-fast/fields_alloc.hpp]
|
2017-06-25 12:03:45 -07:00
|
|
|
* [repo_file example/http-server-fast/http_server_fast.cpp]
|
2017-06-23 01:44:25 -07:00
|
|
|
|
|
|
|
[endsect]
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-23 18:23:55 -07:00
|
|
|
[section HTTP Server (Small)]
|
|
|
|
|
|
|
|
This example implements a very simple HTTP server
|
|
|
|
suitable as a starting point on an embedded device.
|
|
|
|
|
|
|
|
* [repo_file example/http-server-small/http_server_small.cpp]
|
|
|
|
|
|
|
|
[endsect]
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[section WebSocket Client (with SSL)]
|
2016-10-02 16:33:42 -04:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
Establish a WebSocket connection over an encrypted TLS connection,
|
|
|
|
send a message and receive the reply. Requires OpenSSL to build.
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-18 17:10:38 -07:00
|
|
|
* [repo_file example/websocket-client-ssl/websocket_client_ssl.cpp]
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
|
|
|
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section Documentation Samples]
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
Here are all of the example functions and classes presented
|
|
|
|
throughout the documentation, they can be included and used
|
|
|
|
in your program without modification
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
* [repo_file example/doc/http_examples.hpp]
|
2017-06-12 19:16:39 -07:00
|
|
|
|
|
|
|
[endsect]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
|
|
|
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[section Composed Operations]
|
2017-05-10 12:03:00 -07:00
|
|
|
|
2017-06-14 20:26:44 -07:00
|
|
|
This program shows how to use Beast's network foundations to build a
|
2017-05-10 12:03:00 -07:00
|
|
|
composable asynchronous initiation function with associated composed
|
|
|
|
operation implementation. This is a complete, runnable version of
|
|
|
|
the example described in the Core Foundations document section.
|
|
|
|
|
2017-06-14 20:26:44 -07:00
|
|
|
* [repo_file example/echo-op/echo_op.cpp]
|
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
|
|
|
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-11 09:59:13 -07:00
|
|
|
|
2017-06-24 22:24:39 -07:00
|
|
|
[section Common Code]
|
|
|
|
|
|
|
|
This code is reused between some of the examples. The header files
|
|
|
|
stand alone can be directly included in your projects.
|
|
|
|
|
2017-06-26 13:28:55 +02:00
|
|
|
* [repo_file example/common/const_body.hpp]
|
2017-06-24 22:24:39 -07:00
|
|
|
* [repo_file example/common/detect_ssl.hpp]
|
|
|
|
* [repo_file example/common/file_body.hpp]
|
|
|
|
* [repo_file example/common/mime_types.hpp]
|
2017-06-26 13:28:55 +02:00
|
|
|
* [repo_file example/common/mutable_body.hpp]
|
2017-06-24 22:24:39 -07:00
|
|
|
* [repo_file example/common/rfc7231.hpp]
|
|
|
|
* [repo_file example/common/ssl_stream.hpp]
|
|
|
|
* [repo_file example/common/write_msg.hpp]
|
|
|
|
|
|
|
|
[endsect]
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
[section Server Framework]
|
2016-09-25 11:19:51 -04:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
This is a complete program and framework of classes implementing
|
|
|
|
a general purpose server that users may copy to use as the basis
|
|
|
|
for writing their own servers. It serves both HTTP and WebSocket.
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-16 19:27:00 -07:00
|
|
|
* [repo_file example/server-framework/file_service.hpp]
|
|
|
|
* [repo_file example/server-framework/framework.hpp]
|
|
|
|
* [repo_file example/server-framework/http_async_port.hpp]
|
|
|
|
* [repo_file example/server-framework/http_base.hpp]
|
|
|
|
* [repo_file example/server-framework/http_sync_port.hpp]
|
2017-06-17 13:42:13 -07:00
|
|
|
* [repo_file example/server-framework/https_ports.hpp]
|
2017-06-16 19:27:00 -07:00
|
|
|
* [repo_file example/server-framework/main.cpp]
|
2017-06-18 06:51:51 -07:00
|
|
|
* [repo_file example/server-framework/multi_port.hpp]
|
2017-06-16 19:27:00 -07:00
|
|
|
* [repo_file example/server-framework/server.hpp]
|
|
|
|
* [repo_file example/server-framework/service_list.hpp]
|
2017-06-17 13:42:13 -07:00
|
|
|
* [repo_file example/server-framework/ssl_certificate.hpp]
|
2017-06-16 19:27:00 -07:00
|
|
|
* [repo_file example/server-framework/ws_async_port.hpp]
|
|
|
|
* [repo_file example/server-framework/ws_sync_port.hpp]
|
|
|
|
* [repo_file example/server-framework/ws_upgrade_service.hpp]
|
2017-06-17 13:42:13 -07:00
|
|
|
* [repo_file example/server-framework/wss_ports.hpp]
|
2017-06-14 20:26:44 -07:00
|
|
|
|
2017-06-12 19:16:39 -07:00
|
|
|
[endsect]
|
|
|
|
|
2016-09-25 11:19:51 -04:00
|
|
|
|
|
|
|
|
|
|
|
[endsect]
|