_design.qbk 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. [/
  2. Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. Official repository: https://github.com/boostorg/beast
  6. ]
  7. [section Design Choices]
  8. The implementations were originally driven by business needs of cryptocurrency
  9. server applications (e.g. [@https://github.com/ripple/rippled rippled]),
  10. written in C++. These needs were not met by existing solutions so Beast
  11. was written from scratch as a solution. Beast's design philosophy avoids
  12. flaws exhibited by other libraries:
  13. * Don't try to do too much.
  14. * Don't sacrifice performance.
  15. * Mimic __Asio__; familiarity breeds confidence.
  16. * Role-symmetric interfaces; client and server the same (or close to it).
  17. * Leave important decisions, such as allocating memory or
  18. managing flow control, to the user.
  19. Beast uses the __DynamicBuffer__ concept presented in the __NetTS__,
  20. and relies heavily on the __ConstBufferSequence__ and
  21. __MutableBufferSequence__ concepts for passing buffers to functions.
  22. The authors have found the dynamic buffer and buffer sequence interfaces to
  23. be optimal for interacting with Asio, and for other tasks such as incremental
  24. parsing of data in buffers (for example, parsing websocket frames stored
  25. in a [link beast.ref.boost__beast__static_buffer `static_buffer`]).
  26. During the development of Beast the authors have studied other software
  27. packages and in particular the comments left during the Boost Review process
  28. of other packages offering similar functionality. In this section and the
  29. FAQs that follow we attempt to answer those questions that are also applicable
  30. to Beast.
  31. For HTTP we model the message to maximize flexibility of implementation
  32. strategies while allowing familiar verbs such as [*`read`] and [*`write`].
  33. The HTTP interface is further driven by the needs of the WebSocket module,
  34. as a WebSocket session requires a HTTP Upgrade handshake exchange at the
  35. start. Other design goals:
  36. * Keep it simple.
  37. * Stay low level; don't invent a whole web server or client.
  38. * Allow for customizations, if the user needs it.
  39. The following video presentation was delivered at
  40. [@https://cppcon.org/ CppCon]
  41. in 2016. It provides a light introduction to some of the earliest
  42. interfaces of Beast (which have since changed).
  43. [/ "Introducing Beast..."]
  44. [block'''
  45. <mediaobject>
  46. <videoobject>
  47. <videodata fileref="https://www.youtube.com/embed/uJZgRcvPFwI?rel=0"
  48. align="center" contentwidth="560" contentdepth="315"/>
  49. </videoobject>
  50. </mediaobject>
  51. ''']
  52. [include 1_http_message.qbk]
  53. [include 2_http_comparison.qbk]
  54. [include 3_websocket_zaphoyd.qbk]
  55. [include 4_faq.qbk]
  56. [endsect]