2017-07-20 08:01:46 -07:00
|
|
|
[/
|
2017-02-06 20:07:03 -05:00
|
|
|
Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2017-07-20 08:01:46 -07: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)
|
|
|
|
|
]
|
|
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
[section:design Design Choices]
|
|
|
|
|
|
|
|
|
|
[block '''
|
|
|
|
|
<informaltable frame="all"><tgroup cols="1"><colspec colname="a"/><tbody><row><entry valign="top"><simplelist>
|
2017-05-26 20:46:43 -07:00
|
|
|
<member><link linkend="beast.design.http_message">HTTP Message Container</link></member>
|
|
|
|
|
<member><link linkend="beast.design.http_comparison">HTTP Comparison to Other Libraries</link></member>
|
|
|
|
|
<member><link linkend="beast.design.websocket_zaphoyd">Comparison to Zaphoyd Studios WebSocket++</link></member>
|
|
|
|
|
<member><link linkend="beast.design.review">Boost Formal Review FAQ</link></member>
|
2016-10-09 14:42:17 -04:00
|
|
|
</simplelist></entry></row></tbody></tgroup></informaltable>
|
|
|
|
|
''']
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
|
The implementations are driven by business needs of cryptocurrency server
|
2016-08-12 19:20:34 -04:00
|
|
|
applications (e.g. [@https://ripple.com Ripple]) written in C++. These
|
|
|
|
|
needs were not met by existing solutions so Beast was written from scratch
|
2016-10-19 20:13:39 +02:00
|
|
|
as a solution. Beast's design philosophy avoids flaws exhibited by other
|
2017-07-20 08:01:46 -07:00
|
|
|
libraries:
|
|
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
* Don't try to do too much.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
* Don't sacrifice performance.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
* Mimic Boost.Asio; familiarity breeds confidence.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
* Role-symmetric interfaces; client and server the same (or close to it).
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-19 20:13:39 +02:00
|
|
|
* Leave important decisions to the user, such as allocating memory or
|
|
|
|
|
managing flow control.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-10 12:39:54 -04:00
|
|
|
Beast uses the __DynamicBuffer__ concept presented in the Networking TS
|
|
|
|
|
(__N4588__), and relies heavily on the Boost.Asio __ConstBufferSequence__
|
|
|
|
|
and __MutableBufferSequence__ concepts for passing buffers to functions.
|
|
|
|
|
The authors have found the dynamic buffer and buffer sequence interfaces to
|
|
|
|
|
be optimal for interacting with Asio, and for other tasks such as incremental
|
2016-10-09 14:42:17 -04:00
|
|
|
parsing of data in buffers (for example, parsing websocket frames stored
|
2017-05-05 12:34:36 -07:00
|
|
|
in a [link beast.ref.static_buffer `static_buffer`]).
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
|
During the development of Beast the authors have studied other software
|
|
|
|
|
packages and in particular the comments left during the Boost Review process
|
2016-10-09 14:42:17 -04:00
|
|
|
of other packages offering similar functionality. In this section and the
|
|
|
|
|
FAQs that follow we attempt to answer those questions that are also applicable
|
|
|
|
|
to Beast.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-19 20:13:39 +02:00
|
|
|
For HTTP we model the message to maximize flexibility of implementation
|
2017-07-20 08:01:46 -07:00
|
|
|
strategies while allowing familiar verbs such as [*`read`] and [*`write`].
|
|
|
|
|
The HTTP interface is further driven by the needs of the WebSocket module,
|
|
|
|
|
as a WebSocket session requires a HTTP Upgrade handshake exchange at the
|
|
|
|
|
start. Other design goals:
|
|
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
* Keep it simple.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-19 20:13:39 +02:00
|
|
|
* Stay low level; don't invent a whole web server or client.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2016-10-09 14:42:17 -04:00
|
|
|
* Allow for customizations, if the user needs it.
|
2017-07-20 08:01:46 -07:00
|
|
|
|
2017-05-26 20:46:43 -07:00
|
|
|
[include design/http_message.qbk]
|
|
|
|
|
[include design/http_comparison.qbk]
|
|
|
|
|
[include design/websocket_zaphoyd.qbk]
|
|
|
|
|
[include design/review.qbk]
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
|
[endsect]
|