Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP/WebSocket Server framework, C++11 header-only using Beast and Boost.Asio #358

Closed
fffaraz opened this issue Jun 17, 2017 · 5 comments
Closed

Comments

@fffaraz
Copy link
Owner

fffaraz commented Jun 17, 2017

The Beast library now offers a complete server framework as an example you can build and run: https://github.com/vinniefalco/Beast/tree/master/example/server-framework
Its got these features:
Comes with a WebSocket echo port handler (sync and async)
Comes with an HTTP port handler (sync and async)
Configurable PortHandler concept for user-defined behaviors
Create your own "ports" by writing a class to take ownership of sockets from incoming connections, plug it in to the server framework, and then publish it as open source so other people can use your ports!
The HTTP ports that come with this example are extensible, defining a Service concept which handles HTTP requests. A Service List aggregates Service objects, and the implementation gives each one a chance to handle the request in turn (kind of like a router, but more powerful!) The example comes with two services:
file_service serves files from a path on your system, like a web server
ws_upgrade_service lets you accept WebSocket connections from the same port as your web server and hands them off to the websocket port handler!
As with PortHandler, you can write your own Service types and plug them into this extensible framework, then share them with other people. For example you could implement a simple Troll-box style WebSocket chat Service which plugs right in to the framework and release that as your own open source library!
This is all built on top of Beast to show off the power of the library. People have asked for higher level functionality. You spoke - we listened! Now you can create a richly featured HTTP/WebSocket server in just a matter of seconds by cloning the server-framework example!
Beast is a C++ header-only library serving as a foundation for writing interoperable networking libraries by providing low-level HTTP/1, WebSocket, and networking protocol vocabulary types and algorithms using the consistent asynchronous model of Boost.Asio.
Beast: https://github.com/vinniefalco/Beast
Documentation: http://vinniefalco.github.io/beast/index.html

@vinniefalco
Copy link

Do I need to do something here? Also, Beast is now part of Boost

@DragonOsman
Copy link

Is there any documentation for the server framework? If not, I think one should be written so that users can more easily learn how to use it. And would one have to write a client for it, or would it be fine to use one of the client examples that come with Beast?

@eXpl0it3r
Copy link
Collaborator

eXpl0it3r commented Dec 18, 2017

Updated URL: https://github.com/boostorg/beast

I think this should be added to the list!

@vinniefalco Maybe do a pull request?

@DragonOsman This is the awesome-cpp repository, for questions regarding the library, check the libraries' resources on how to get help. 🙂

@DragonOsman
Copy link

Would it be good to just ask on the Beast GitHub page?

@vinniefalco
Copy link

I got rid of that silly framework server example, it was too complicated for the few features it offered. I scaled it back and I have instead created many smaller example programs in a variety of styles: synchronous, asynchronous, coroutine, and stackless coroutine, with clients and servers, with or without SSL, for HTTP or WebSocket. There are also "advanced" servers which support both HTTP and WebSocket on the same port, and a "flex" server that can handle plain and SSL on the same port. See:

http://www.boost.org/doc/libs/master/libs/beast/doc/html/beast/examples.html

This many smaller examples serves users better than the previous one large example.

NexWeb added a commit to NexWeb/awesome-cpp that referenced this issue Nov 23, 2019
* Updated the miniz link and adjusted the license

Google Code has been shutdown for a while, miniz has been continued on GitHub.
Due to adding ZIP64 support, which came from valve's vogl project, the license was changed to MIT.

* Machine learning: add flashlight library

* mini_al to miniaudio

mini_al has been rebranded to miniaudio.

* Containers: Added the Forest library

Forest is a template library implementing an AVL, a Binary Search, a KD and a Quad Tree.

* added 8 new weblogs

* Build System: Update vcpkg description

* Networking: Add restclient-cpp

* added stl

* Added CppChat to list of podcasts

* Fixed CppChat URL

* Added restinio

* Add libfacedetection. Closes fffaraz#704

* Multimedia: Add libass (fix fffaraz#650)

* Networking: Add cpp-netlib/uri (fix fffaraz#700)

* Networking: Add uriparser (fix fffaraz#639)

* Math: Add SymEngine (fix fffaraz#675)

* Add libsndfile (fffaraz#709)

* Update README.md

* Added iup gui library

* Add nameof

* Update nameof

* Fix typo

* Update README URLs based on HTTP redirects (fffaraz#188)

* added section for reflection libs (fffaraz#189)

* Added MQTT-C (fffaraz#599)

* Added PortAudio library (fix fffaraz#175) (fffaraz#248)

* Memory Allocation: Add memory-allocators (fix fffaraz#660)

* Networking: Add Boost.Beast

Closes fffaraz#267
Closes fffaraz#332
Closes fffaraz#358

* Move Nameof to Reflection section (fffaraz#720)

* Fixes fffaraz#722

* Game Engine: Add raylib

* Add static reflection for enums lib (fffaraz#727)

* Game Engine: Add Spring

* adding universal numbers library

* Graphics: Add Blend2D (fix fffaraz#620)

* Debug: Add Unity

* Clean todo.txt

* added icecream-cpp

* Networking: Add librdkafka

* Miscellaneous: Add CPPIterTools (fix fffaraz#740)

* Miscellaneous: Add mio (fix fffaraz#688)

* Miscellaneous: Remove Better Enums

* Miscellaneous: Move meta to Reflection section

* Miscellaneous: Move PHP-CPP to Scripting section

* Move ZeroMQ to Networking section (fffaraz#714)

ZeroMQ is more than just for IPC, so I moved it to a more general section (Networking).
Also updated the link to point to the GitHub repository.

* Add Intel Games Task Scheduler - Fixes fffaraz#730

* Debug: Add Nonius (fix fffaraz#721)

* Concurrency: Add FiberTaskingLib (fix fffaraz#754)

* Added Hyperscan and PIRE under regexps section

* Regexps section extended for Hyperscan and PIRE libs

* Added Hyperscan and PIRE to regexps section

* feat: Add Quantum++ To Physics Section

Quantum++ is a modern C++11 general purpose quantum computing library, composed solely of template header files. Quantum++ is written in standard C++11 and has very low external dependencies, using only the Eigen 3 linear algebra header-only template library and, if available, the OpenMP multi-processing library.

* Reflection: Add visit_struct (fix fffaraz#779)

* Misc: Update PEGTL (fix fffaraz#767)

* Add Buck build system

* Add awesome-modern-cpp

* Added CSV Parser (fffaraz#511)

* Add drogon to the list (fffaraz#797)

* Internationalization: Add utf8proc

* Fixed typo

* Added pinam45/dynamic_bitset to containers

* Add daniele77/cli (fffaraz#804)

* Move libcsptr to Memory Allocation (fix fffaraz#772)

* Update README.md

closes fffaraz#588

* Math: Add linalg.h

* CSV: Add csv, fast-cpp-csv-parser

Fix fffaraz#751
Fix fffaraz#800

* JSON: Add taoJSON (fix fffaraz#768)

* Math: Update GLM

* Clean todo.txt

* Containers: Add robin-hood-hashing, robin-map

* Serialization: Update protobuf, upb repo link

* Networking: Add mTCP

* Networking: Add lwIP (fix fffaraz#811)

* Memory Allocation: Add mimalloc

* JSON: Add cJSON, simdjson

Fix fffaraz#677
Fix fffaraz#733

* Added kgabis/parson (fffaraz#831)

* Debug: Add dbg-macro

* Adding www.boden.io GUI Framework

* Coding Style Tools: Update Uncrustify

* Articles: Add C++Now 2019

* libjingle has been discontinued

* Image Processing: Add Leptonica (fffaraz#557)

* Networking: Add DPDK (close fffaraz#820), PF_RING

* Game Engine: Add Corange (close fffaraz#837)

* Font: Add Fontconfig, FreeType, otfcc (close fffaraz#825)

* Machine Learning: Add darknet (close fffaraz#530)

* Add promise-cpp, the Promise/A+ library in c++ (fffaraz#612)

* Memory Allocation: Add tgc (close fffaraz#838)

* Travis-CI: Allow duplicate links, skip SSL error

Travis-CI: Clean dead links

* Update capnproto (close fffaraz#743)

* Graphics: Add LLGL

* Configuration: Add inih, iniparser, libconfuse, simpleini

Close fffaraz#602
Close fffaraz#832

* Configuration: Add inih

* Machine Learning: Add libsvm

* Update README.md

No longer a header only library 

See https://github.com/zuhd-org/easyloggingpp

* Configuration: Add libconfig

* Adding Verovio (fffaraz#872)

* Add Bitsery (fffaraz#871)

* Add bit7z

* update repo url after juCi++ was moved to gitlab

* Reflection: Add magic_get (fix fffaraz#877)

* add: kcp protocol

* update kcp description

* update description

* remove duplicate libhydrogen

* Coding Style Tools: Add EditorConfig (fix fffaraz#828), Prettier

* Coding Style Tools: Remove Prettier

* Audio: Add libsoundio (fix fffaraz#883)

* Serialization: Add Boost Serialization

* Update README.md

* Update contributors guidelines

* Add litePDF into PDF category

* Add Lyra into CLI category (fffaraz#899)

* Add IKOS from NASA to static analyzers (fffaraz#901)

* Add C++ REST SDK into Web Application Framework category

* [Debug] Add `μt` Unit Testing Framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants