mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
Doc fixes and tidy
This commit is contained in:
@ -3,6 +3,7 @@ Version 62:
|
|||||||
* Remove libssl-dev from a Travis matrix item
|
* Remove libssl-dev from a Travis matrix item
|
||||||
* Increase detail::static_ostream coverage
|
* Increase detail::static_ostream coverage
|
||||||
* Add server-framework tests
|
* Add server-framework tests
|
||||||
|
* Doc fixes and tidy
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -80,8 +80,6 @@ Here are all of the example functions and classes presented
|
|||||||
throughout the documentation, they can be included and used
|
throughout the documentation, they can be included and used
|
||||||
in your program without modification
|
in your program without modification
|
||||||
|
|
||||||
* [repo_file example/doc/core_examples.hpp]
|
|
||||||
|
|
||||||
* [repo_file example/doc/http_examples.hpp]
|
* [repo_file example/doc/http_examples.hpp]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
@ -10,6 +10,7 @@ It contains the following components
|
|||||||
|
|
||||||
* WebSocket ports (synchronous and asynchronous)
|
* WebSocket ports (synchronous and asynchronous)
|
||||||
- Echoes back any message received
|
- Echoes back any message received
|
||||||
|
- Plain or SSL (if OpenSSL available)
|
||||||
|
|
||||||
* HTTP ports (synchronous and asynchronous)
|
* HTTP ports (synchronous and asynchronous)
|
||||||
- Serves files from a configurable directory on GET request
|
- Serves files from a configurable directory on GET request
|
||||||
@ -17,6 +18,9 @@ It contains the following components
|
|||||||
- Routes WebSocket Upgrade requests to a WebSocket port
|
- Routes WebSocket Upgrade requests to a WebSocket port
|
||||||
- Handles Expect: 100-continue
|
- Handles Expect: 100-continue
|
||||||
- Supports pipelined requests
|
- Supports pipelined requests
|
||||||
|
- Plain or SSL (if OpenSSL available)
|
||||||
|
|
||||||
|
* Multi-Port: Plain, OpenSSL, HTTP, WebSocket **All on the same port!**
|
||||||
|
|
||||||
The server is designed to use modular components that users may simply copy
|
The server is designed to use modular components that users may simply copy
|
||||||
into their own project to get started quickly. Two concepts are introduced:
|
into their own project to get started quickly. Two concepts are introduced:
|
||||||
@ -24,16 +28,17 @@ into their own project to get started quickly. Two concepts are introduced:
|
|||||||
## PortHandler
|
## PortHandler
|
||||||
|
|
||||||
The **PortHandler** concept defines an algorithm for handling incoming
|
The **PortHandler** concept defines an algorithm for handling incoming
|
||||||
connections received on a listening socket. The example comes with four
|
connections received on a listening socket. The example comes with a
|
||||||
port handlers:
|
total of *nine* port handlers!
|
||||||
|
|
||||||
* `http_sync_port` Serves HTTP content using synchronous Beast calls
|
| Type | Plain | SSL |
|
||||||
|
| ----- | ----------------- | ------------------ |
|
||||||
|
| Sync | `http_sync_port` | `https_sync_port` |
|
||||||
|
| | `ws_sync_port` | `wss_sync_port` |
|
||||||
|
| Async | `http_async_port` | `https_async_port` |
|
||||||
|
| | `wss_sync_port` | `wss_async_port` |
|
||||||
|
| | `multi_port` | `multi_port` |
|
||||||
|
|
||||||
* `http_async_port` Serves HTTP content using asynchronous Beast calls
|
|
||||||
|
|
||||||
* `ws_sync_port` A synchronous WebSocket echo server using synchronous Beast calls
|
|
||||||
|
|
||||||
* `ws_async_port` An asynchronous WebSocket echo server using synchronous Beast calls
|
|
||||||
|
|
||||||
A port handler takes the stream object resulting form an incoming connection
|
A port handler takes the stream object resulting form an incoming connection
|
||||||
request and constructs a handler-specific connection object which provides
|
request and constructs a handler-specific connection object which provides
|
||||||
@ -57,7 +62,7 @@ to a websocket port handler.
|
|||||||
|
|
||||||
## Relationship
|
## Relationship
|
||||||
|
|
||||||
This diagram shows the relationship of the server object, to the four
|
This diagram shows the relationship of the server object, to the nine
|
||||||
ports created in the example program, and the HTTP services contained by
|
ports created in the example program, and the HTTP services contained by
|
||||||
the HTTP ports:
|
the HTTP ports:
|
||||||
|
|
||||||
@ -135,3 +140,20 @@ struct Service
|
|||||||
Send const& send) const
|
Send const& send) const
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Upgrade Service Requirements
|
||||||
|
|
||||||
|
To work with the `ws_upgrade_service`, a port or handler needs
|
||||||
|
this signature:
|
||||||
|
```C++
|
||||||
|
|
||||||
|
struct UpgradePort
|
||||||
|
{
|
||||||
|
template<class Stream, class Body, class Fields>
|
||||||
|
void
|
||||||
|
on_upgrade(
|
||||||
|
Stream&& stream,
|
||||||
|
endpoint_type ep,
|
||||||
|
beast::http::request<Body, Fields>&& req);
|
||||||
|
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user