Vinnie Falco e2c67a1666 Fixes and documentation for teardown and use with SSL:
This solves a problem where clang and gcc locate the deleted
version of teardown and async_teardown instead of the overloaded
version. It requires overloads to add `teardown_tag` into the signature
so that the rules for argument dependent lookup can find the
right function. Improve documentation of teardown requirements

The documentation is updated to clearly explain the need for including
<beast/websocket/ssl.hpp> to use SSL streams with WebSocket.

The default implementations of teardown and async_teardown now use
static_assert to alert the user of improper usage, with comments
providing guidance for resolving the error.
2016-07-06 13:36:14 -04:00
2016-05-28 07:16:31 -04:00
2013-06-02 08:55:07 -07:00
2016-05-28 07:16:31 -04:00
2016-05-28 07:16:31 -04:00
2016-05-12 19:22:00 -04:00
2016-05-25 12:00:14 -04:00
2016-06-03 11:43:56 -04:00

Beast

Join the chat at https://gitter.im/vinniefalco/Beast ![Build Status] (https://travis-ci.org/vinniefalco/Beast.svg?branch=master) ![codecov] (https://codecov.io/gh/vinniefalco/Beast/branch/master/graph/badge.svg) ![coveralls] (https://coveralls.io/repos/github/vinniefalco/Beast/badge.svg?branch=master) ![Documentation] (https://img.shields.io/badge/documentation-master-brightgreen.svg) ![License] (https://img.shields.io/badge/license-boost-brightgreen.svg)

Beast provides implementations of the HTTP and WebSocket protocols built on top of Boost.Asio and other parts of boost.

Requirements:

  • Boost
  • C++11 or greater
  • OpenSSL (optional)

This software is currently in beta: interfaces are subject to change. For recent changes see CHANGELOG. The library has been submitted to the Boost Library Incubator

Example WebSocket program:

#include <beast/to_string.hpp>
#include <beast/websocket.hpp>
#include <boost/asio.hpp>
#include <iostream>
#include <string>

int main()
{
    // Normal boost::asio setup
    std::string const host = "echo.websocket.org";
    boost::asio::io_service ios;
    boost::asio::ip::tcp::resolver r(ios);
    boost::asio::ip::tcp::socket sock(ios);
    boost::asio::connect(sock,
        r.resolve(boost::asio::ip::tcp::resolver::query{host, "80"}));

    // WebSocket connect and send message using beast
    beast::websocket::stream<boost::asio::ip::tcp::socket&> ws(sock);
    ws.handshake(host, "/");
    ws.write(boost::asio::buffer("Hello, world!"));

    // Receive WebSocket message, print and close using beast
    beast::streambuf sb;
    beast::websocket::opcode op;
    ws.read(op, sb);
    ws.close(beast::websocket::close_code::normal);
    std::cout << to_string(sb.data()) << "\n";
}

Example HTTP program:

#include <beast/http.hpp>
#include <boost/asio.hpp>
#include <iostream>
#include <string>

int main()
{
    // Normal boost::asio setup
    std::string const host = "boost.org";
    boost::asio::io_service ios;
    boost::asio::ip::tcp::resolver r(ios);
    boost::asio::ip::tcp::socket sock(ios);
    boost::asio::connect(sock,
        r.resolve(boost::asio::ip::tcp::resolver::query{host, "http"}));

    // Send HTTP request using beast
    beast::http::request_v1<beast::http::empty_body> req;
    req.method = "GET";
    req.url = "/";
    req.version = 11;
    req.headers.replace("Host", host + ":" + std::to_string(sock.remote_endpoint().port()));
    req.headers.replace("User-Agent", "Beast");
    beast::http::prepare(req);
    beast::http::write(sock, req);

    // Receive and print HTTP response using beast
    beast::streambuf sb;
    beast::http::response_v1<beast::http::streambuf_body> resp;
    beast::http::read(sock, sb, resp);
    std::cout << resp;
}

Links:

Please report issues or questions here: https://github.com/vinniefalco/Beast/issues

Description
Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
Readme 2.1 GiB
Languages
C++ 99.4%
CMake 0.5%