Beast: HTTP, WebSocket


#1

What has Vinnie been up to? I’ve been toiling away at Ripple and one of the latest things to appear is Beast, a new cross platform open source library that uses boost and offers HTTP and WebSocket:

Beast

This is a new open source library that implements the HTTP and WebSocket protocols using Boost.Asio and a few other Boost tidbits. Here’s a quick synopsis of what’s in it:

http::message
class template modeling the HTTP message with customization points to satisfy even the most tough-minded reviewer.

http::read
http::write
http::async_read
http::async_write

Free functions to easily send and receive HTTP messages. Modeled to work exactly like boost::asio free functions. Role-agnostic, build clients or servers!

websocket::stream
class template wrapping any asio sync or async stream. Implements the WebSocket protocol including the initial handshake.

Examples:

  • websocket echo servers
  • HTTP servers for simple websites (no cgi)

"I’ve heard enough, show me example code!"
http://vinniefalco.github.io/beast/beast/intro/example.html

Main page, with links to GitHub repository, HTML documentation and benchmarks:
http://vinniefalco.github.io/

Feedback welcome, the author checks email and Issues on the GitHub repository. This project has been submitted to the Boost incubator.


#2

Hey Vinnie, good to hear from you after all this time!


#3

Thanks! Looks like JUCE has really grown!


#4

Yes, bigger codebase, bigger team, bigger userbase… Growing in all directions!


#5

I presented Beast at a CppCon 2016 Lightning talk, video is here:


#6

I’m trying to connect a JUCE application (audio plugin) to a websocket, the protocol for which is not implemented in the juce Url or StreamingSocket classes which handle raw HTTP and TCP.

I’m considering trying to compile Beast in the same application and use its websocket implementation to handle that part, but I might be missing something obvious. Can you see any reason why this would be a bad idea? or an easier way (not sure how well boost::asio would play with juce’s threads in an audio plugin)?


#7

I have the same question. What is the shortest way to get a functioning websocket up and running in Juce? I have looked at websocketpp and Beast, but it seem like overkill to implement any of them.

Please help.