A library for easy HTTP and websockets messaging in C++ applications.
Rockets
provides the following features:
Rockets
extends the 2.0 specification by providing support for Cancellation and Progress notifications of pending requests.
libuv
through the appropriate Server
constructorRockets
is a cross-platform library designed to run on any modern operating system, including all Unix variants.
It requires a C++11 compiler and uses CMake to create a platform specific build environment.
The following platforms and build environments are tested:
Rockets
requires the following external, pre-installed dependencies:
Building from source is as simple as:
git clone --recursive https://github.com/BlueBrain/Rockets.git
mkdir Rockets/build
cd Rockets/build
cmake -GNinja ..
ninja
#include <rockets/server.h>
#include <iostream>
int main(int , char** )
{
rockets::Server server;
std::cout << "Rockets REST server running on " << server.getURI() << std::endl;
server.handle(rockets::http::Method::GET, "hello", [](auto) {
return rockets::http::make_ready_response(rockets::http::Code::OK, "world");
});
for(;;)
server.process(100);
return 0;
}
#include <rockets/server.h>
#include <iostream>
int main(int , char** )
{
rockets::Server server("", "myws");
std::cout << "Rockets websockets server running on " << server.getURI() << std::endl;
server.handleText([](const auto& request) {
return "server echo: " + request.message;
});
for(;;)
server.process(100);
return 0;
}
For a more elaborate use of a Rockets
REST server, check out the RestServer of Tide.
For a more elaborate use of a Rockets
websockets server, check out the RocketsPlugin of Brayns.
Follow the next guidelines when making a contribution:
pre-commit install
prior the first commitThe development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH Board of the Swiss Federal Institutes of Technology.
Copyright (c) 2021 Blue Brain Project/EPFL
Rockets is licensed under the LGPL version 3, unless noted otherwise, e.g., for external dependencies. See file LICENSE.txt for the full license. External dependencies are either LGPL or BSD-licensed. See file ACKNOWLEDGEMENTS.txt and AUTHORS.txt for further details.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA