rockets-client

REST and websockets C++ library

Showing:

Popularity

Downloads/wk

9

GitHub Stars

35

Maintenance

Last Commit

7d ago

Contributors

9

Package

Dependencies

3

Size (min+gzip)

28.2KB

License

LGPL-3.0+

Type Definitions

Built-In

Tree-Shakeable

Yes?

Categories

Readme

Rockets

A library for easy HTTP and websockets messaging in C++ applications.

Travis CI Language grade: C/C++

Table of Contents

Features

Rockets provides the following features:

Build

Rockets 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:

  • Linux: Ubuntu 16.04, 18.04
  • Mac OS X: 10.9 - 10.14

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

Usage

Hello world REST server

#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;
}

Hello world websockets server

#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;
}

Production REST server example

For a more elaborate use of a Rockets REST server, check out the RestServer of Tide.

Production websockets server example

For a more elaborate use of a Rockets websockets server, check out the RocketsPlugin of Brayns.

Contribute

Follow the next guidelines when making a contribution:

  • Install our pre-commit hooks with pre-commit install prior the first commit
  • Use Conventional Commits spec whenever making a commit
  • Keep PRs to a single feature or fix

Funding & Acknowledgment

The 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

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100