websocket and http client and server library, coming with ws, a command line swiss army knife utility

Overview

Hello world

IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use and support everything you'll likely need for websocket dev (SSL, deflate compression, compiles on most platforms, etc...). HTTP client and server code is also available, but it hasn't received as much testing.

It is been used on big mobile video game titles sending and receiving tons of messages since 2017 (iOS and Android). It was tested on macOS, iOS, Linux, Android, Windows and FreeBSD. Note that the MinGW compiler is not supported at this point. Two important design goals are simplicity and correctness.

A bad security bug affecting users compiling with SSL enabled and OpenSSL as the backend was just fixed in newly released version 11.0.0. Please upgrade ! (more details in the https://github.com/machinezone/IXWebSocket/pull/250.

/*
 *  main.cpp
 *  Author: Benjamin Sergeant
 *  Copyright (c) 2020 Machine Zone, Inc. All rights reserved.
 *
 *  Super simple standalone example. See ws folder, unittest and doc/usage.md for more.
 *
 *  On macOS
 *  $ mkdir -p build ; (cd build ; cmake -DUSE_TLS=1 .. ; make -j ; make install)
 *  $ clang++ --std=c++11 --stdlib=libc++ main.cpp -lixwebsocket -lz -framework Security -framework Foundation
 *  $ ./a.out
 *
 *  Or use cmake -DBUILD_DEMO=ON option for other platforms
 */

#include <ixwebsocket/IXNetSystem.h>
#include <ixwebsocket/IXWebSocket.h>
#include <ixwebsocket/IXUserAgent.h>
#include <iostream>

int main()
{
    // Required on Windows
    ix::initNetSystem();

    // Our websocket object
    ix::WebSocket webSocket;

    // Connect to a server with encryption
    // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration
    std::string url("wss://echo.websocket.org");
    webSocket.setUrl(url);

    std::cout << "Connecting to " << url << "..." << std::endl;

    // Setup a callback to be fired (in a background thread, watch out for race conditions !)
    // when a message or an event (open, close, error) is received
    webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg)
        {
            if (msg->type == ix::WebSocketMessageType::Message)
            {
                std::cout << "received message: " << msg->str << std::endl;
                std::cout << "> " << std::flush;
            }
            else if (msg->type == ix::WebSocketMessageType::Open)
            {
                std::cout << "Connection established" << std::endl;
                std::cout << "> " << std::flush;
            }
            else if (msg->type == ix::WebSocketMessageType::Error)
            {
                // Maybe SSL is not configured properly
                std::cout << "Connection error: " << msg->errorInfo.reason << std::endl;
                std::cout << "> " << std::flush;
            }
        }
    );

    // Now that our callback is setup, we can start our background thread and receive messages
    webSocket.start();

    // Send a message to the server (default to TEXT mode)
    webSocket.send("hello world");

    // Display a prompt
    std::cout << "> " << std::flush;

    std::string text;
    // Read text from the console and send messages in text mode.
    // Exit with Ctrl-D on Unix or Ctrl-Z on Windows.
    while (std::getline(std::cin, text))
    {
        webSocket.send(text);
        std::cout << "> " << std::flush;
    }

    return 0;
}

Interested? Go read the docs! If things don't work as expected, please create an issue on GitHub, or even better a pull request if you know how to fix your problem.

IXWebSocket is actively being developed, check out the changelog to know what's cooking. If you are looking for a real time messaging service (the chat-like 'server' your websocket code will talk to) with many features such as history, backed by Redis, look at cobra.

IXWebSocket client code is autobahn compliant beginning with the 6.0.0 version. See the current test results. Some tests are still failing in the server code.

Starting with the 11.0.8 release, IXWebSocket should be fully C++11 compatible.

Users

If your company or project is using this library, feel free to open an issue or PR to amend this list.

  • Machine Zone
  • Tokio, a discord library focused on audio playback with node bindings.
  • libDiscordBot, an easy to use Discord-bot framework.
  • gwebsocket, a websocket (lua) module for Garry's Mod
  • DisCPP, a simple but feature rich Discord API wrapper
  • discord.cpp, a discord library for making bots
  • Teleport, Teleport is your own personal remote robot avatar

Alternative libraries

There are plenty of great websocket libraries out there, which might work for you. Here are a couple of serious ones.

uvweb is a library written by the IXWebSocket author which is built on top of uvw, which is a C++ wrapper for libuv. It has more dependencies and does not support SSL at this point, but it can be used to open multiple connections within a single OS thread thanks to libuv.

To check the performance of a websocket library, you can look at the autoroute project.

Continuous Integration

OS TLS Sanitizer Status
Linux OpenSSL None Build2
macOS Secure Transport Thread Sanitizer Build2
macOS OpenSSL Thread Sanitizer Build2
macOS MbedTLS Thread Sanitizer Build2
Windows Disabled None Build2
UWP Disabled None Build2
Linux OpenSSL Address Sanitizer Build2
Mingw Disabled None Build2
  • ASAN fails on Linux because of a known problem, we need a
  • Some tests are disabled on Windows/UWP because of a pathing problem
  • TLS and ZLIB are disabled on Windows/UWP because enabling make the CI run takes a lot of time, for setting up vcpkg.
Comments
  • Add close code/reason to class websocket and fix code given in callback on remote side

    Add close code/reason to class websocket and fix code given in callback on remote side

    WARNING: this PR rely on PR #41 , this last one should be merged first

    • Add close code / close reason in close() of Websocket class
    • Fix an issue about callback/code read from remote. When we close the connection using close(code, reason...), a CLOSE frame is sent to the remote, and then right after we really close the socket connection. On the remote side, the CLOSE frame data are read, then the connection is immediately closed so the close callback is called with 1006 / Abnormal close instead of the values of the CLOSE frame, because these data are not processed in the dispatch yet. The fix is to close the connection, set that we need to read the buffer, and if nothing triggered a CLOSED state with the data read, then call the callback with 1006 / Abnormal close
    • Added tests for close()
    opened by AlexandreK38 53
  • IXWebsocket with jetty + Tomcat websocket's server

    IXWebsocket with jetty + Tomcat websocket's server

    Dear @bsergean , I'm really thankful for your great project and your helpful role to respond your IXWebsocket's followers. IXWebsocket works with its own websocket's server correctly.I decided to test it with another websocket's server (Tomcat,Jetty, ......). I couldn't open and send text or binary message and the getReadyState() is onClosing. my question is : are other websocket's server supported by the IXWebsocket?

    opened by EhsanVahab 38
  • Asynchronous version of IXWebSocket::stop()

    Asynchronous version of IXWebSocket::stop()

    Heyo,

    Still a huge fan of this library. I was curious if it would be possible to get an asynchronous version of IXWebSocket::stop(). At the moment, I create the IXWebSocket instance on my main thread and I use start() to run it. In order to ensure stop() runs as fast as possible, I call close(), wait a few seconds, then I call stop() before deallocating the instance.

    However, regardless of what I do to ensure stop() executes as fast as possible, it always takes about 14ms (measured with steady_clock) for stop() to join the thread and terminate, which is too long for my main thread to block as I only have about 11ms of frame time.

    I'd love an asynchronous stop() that I can call so that way when I deallocate my IXWebSocket instance and the destructor calls the synchronous version of stop(), it completes instantly.

    I'm also open to other ways of architecting this. I'm tempted to run IXWebSocket in blocking mode on my own thread using connect(), but then I lose all of the auto-reconnect with exponential backoff logic.

    Max

    opened by maxweisel 26
  • Client can't send large messages over TLS

    Client can't send large messages over TLS

    When trying to send large messages over TLS (the smallest I could reproduce the issue is 100k) the data received in the server is messed up and server closes the connection. I tried several different clients and several different servers, the issue appears only with the IXWebSocket client connecting to different servers. I was able to debug a little bit and seems the problem appears when in SocketOpenSSL::send SSL_write returns SSL_ERROR_WANT_WRITE. After that the packets that are received in the server are not the ones being queued by the client.

    The issue can be reproduced with the following command:

    ./ws send --verify_none wss://echo.websocket.org ws
    

    Compiled latest master on Fedora 29, gcc 8.2.1, OpenSSL 1.1.1

    Some of the logging info I received: ./ws send --verify_none wss://echo.websocket.org ws [2020-01-04 20:05:01.468] [info] ws_send: Connecting to url: wss://echo.websocket.org [2020-01-04 20:05:01.468] [info] ws_send: Connecting... [2020-01-04 20:05:01.928] [info] ws_send: connected [2020-01-04 20:05:01.929] [info] Uri: / [2020-01-04 20:05:01.929] [info] Headers: [2020-01-04 20:05:01.929] [info] ws_send: Sending... [2020-01-04 20:05:01.929] [info] Connection: Upgrade [2020-01-04 20:05:01.929] [info] Date: Sat, 04 Jan 2020 20:01:01 GMT [2020-01-04 20:05:01.929] [info] Sec-WebSocket-Accept: IJCOoaSZaazYviZ5jfGFIx2E7uA= [2020-01-04 20:05:01.929] [info] Server: Kaazing Gateway [2020-01-04 20:05:01.929] [info] Upgrade: websocket [2020-01-04 20:05:02.013] [info] load file from disk completed in 84 [2020-01-04 20:05:02.724] [info] ws_send: Step 0 out of 990 [2020-01-04 20:05:02.725] [info] ws_send: Step 1 out of 990 ... [2020-01-04 20:05:03.085] [info] ws_send: Step 438 out of 990 [2020-01-04 20:05:03.085] [info] ws_send: Invalid ix::WebSocketMessageType [2020-01-04 20:05:03.086] [info] ws_send: Step 439 out of 990 ... [2020-01-04 20:05:03.213] [info] ws_send: Step 594 out of 990 [2020-01-04 20:05:03.214] [info] ws_send: Invalid ix::WebSocketMessageType [2020-01-04 20:05:03.214] [info] ws_send: Step 595 out of 990 ... [2020-01-04 20:05:03.346] [info] ws_send: Step 757 out of 990 [2020-01-04 20:05:03.347] [info] ws_send: Invalid ix::WebSocketMessageType [2020-01-04 20:05:03.347] [info] ws_send: Step 758 out of 990 ... [2020-01-04 20:05:03.369] [info] ws_send: Step 785 out of 990 [2020-01-04 20:05:03.369] [info] ws_send: Invalid ix::WebSocketMessageType [2020-01-04 20:05:03.370] [info] ws_send: Step 786 out of 990 [2020-01-04 20:05:03.371] [info] ws_send: Step 787 out of 990 [2020-01-04 20:05:03.372] [info] ws_send: Step 788 out of 990 [2020-01-04 20:05:03.372] [info] ws_send: connection closed: code 1002 reason [2020-01-04 20:05:03.372] [info] ws_send: Step 789 out of 990 ... [2020-01-04 20:05:03.534] [info] ws_send: Step 988 out of 990 [2020-01-04 20:05:03.536] [info] ws_send: Step 989 out of 990 [2020-01-04 20:05:03.537] [info] ws_send: 32180253 bytes left to be sent [2020-01-04 20:05:03.547] [info] ws_send: 32180253 bytes left to be sent ... endless retry ...

    opened by slavslavov 25
  • [WIP]: Tls peer verify: continued

    [WIP]: Tls peer verify: continued

    Peer verify work, continued. This is to handle the other changes that were in the pipe...I'll remove the [WIP] tag when ready.

    TODO: IXWebSocket

    • [x] OpenSSL
    • [ ] MBedTLS
    • [ ] AppleSSL
    • [ ] SChannel
    • [ ] tests
    • [x] docs

    ws cli

    • [x] send
    • [x] receive
    • [x] transfer
    • [x] connect
    • [x] echo_server
    • [x] broadcast_server
    • [x] ping
    • [x] curl
    • [ ] tests
    • [ ] docs
    opened by matt-deboer 22
  • The conan recipe is horribly outdated

    The conan recipe is horribly outdated

    The reason I'm opening this issue here is because the link to the conan recipe is in the readme. The recipe has several issues that, judging by recent commits as well, appear to be by design, or as a result of not being officially updated

    I've been wanting to try out this library, but because of incompatible build systems, I have to use Conan.

    I couldn't find IXWebSocket in any conan repository - only a recipe. So I went ahead and cloned it, and ran the command I'll be using for all these: conan create . IXWebSocket/stable. Output on the first go:

    ERROR: Failed requirement 'OpenSSL/1.1.1b@zinnion/stable' from 'IXWebSocket/1.5.7@IXWebSocket/stable'
    ERROR: Unable to find 'OpenSSL/1.1.1b@zinnion/stable' in remotes
    

    I took a look at the dependencies, and they appear to be practically identical to the ones found in the official conan repo. So I replaced the dependencies with the same versions from conan/stable. Before that, I noticed the conan recipe is actually using a fork off this repo that's over 500 commits behind, and it's running 1.5.7, which is non-existent for this repo.

    Anyway, re-run, fails:

    [ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
    /usr/bin/clang++  -D_GLIBCXX_USE_CXX11_ABI=1 -I/root/.conan/data/IXWebSocket/1.5.7/IXWebSocket/stable/package/2d89e03e00941cc4186fea9b793094a560d9fb7b/include -I/root/.conan/data/OpenSSL/1.1.1b/conan/stable/package/e93595837cd71d31cd792a7899549d9f13bcd0cc/include -I/root/.conan/data/zlib/1.2.11/conan/stable/package/6d87124bcf4cc4435e13c44634d61b77404bef31/include  -m64 -stdlib=libstdc++ -O3 -DNDEBUG    -std=gnu++1z -o CMakeFiles/test_package.dir/test_package.cpp.o -c /programming/conanOrig/test_package/test_package.cpp
    [100%] Linking CXX executable bin/test_package
    /usr/bin/cmake -E cmake_link_script CMakeFiles/test_package.dir/link.txt --verbose=1
    /usr/bin/clang++    -m64 -stdlib=libstdc++ -O3 -DNDEBUG        -rdynamic CMakeFiles/test_package.dir/test_package.cpp.o  -o bin/test_package  -L/root/.conan/data/IXWebSocket/1.5.7/IXWebSocket/stable/package/2d89e03e00941cc4186fea9b793094a560d9fb7b/lib  -L/root/.conan/data/OpenSSL/1.1.1b/conan/stable/package/e93595837cd71d31cd792a7899549d9f13bcd0cc/lib  -L/root/.conan/data/zlib/1.2.11/conan/stable/package/6d87124bcf4cc4435e13c44634d61b77404bef31/lib -Wl,-rpath,/root/.conan/data/IXWebSocket/1.5.7/IXWebSocket/stable/package/2d89e03e00941cc4186fea9b793094a560d9fb7b/lib:/root/.conan/data/OpenSSL/1.1.1b/conan/stable/package/e93595837cd71d31cd792a7899549d9f13bcd0cc/lib:/root/.conan/data/zlib/1.2.11/conan/stable/package/6d87124bcf4cc4435e13c44634d61b77404bef31/lib -lixwebsocket -lssl -lcrypto -ldl -lpthread -lz
    /root/.conan/data/IXWebSocket/1.5.7/IXWebSocket/stable/package/2d89e03e00941cc4186fea9b793094a560d9fb7b/lib/libixwebsocket.a(IXSocketFactory.cpp.o): In function `ix::createSocket(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
    IXSocketFactory.cpp:(.text+0x52): undefined reference to `ix::SocketOpenSSL::SocketOpenSSL(int)'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    CMakeFiles/test_package.dir/build.make:97: recipe for target 'bin/test_package' failed
    make[2]: *** [bin/test_package] Error 1
    make[2]: Leaving directory '/programming/conanOrig/test_package/build/47edf16f7c6208a569a5a85106a6734e405b9db6'
    CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/test_package.dir/all' failed
    make[1]: *** [CMakeFiles/test_package.dir/all] Error 2
    make[1]: Leaving directory '/programming/conanOrig/test_package/build/47edf16f7c6208a569a5a85106a6734e405b9db6'
    Makefile:86: recipe for target 'all' failed
    make: *** [all] Error 2
    ERROR: IXWebSocket/1.5.7@IXWebSocket/stable (test package): Error in build() method, line 15
            cmake.build()
            ConanException: Error 512 while executing cmake --build '/programming/conanOrig/test_package/build/47edf16f7c6208a569a5a85106a6734e405b9db6' '--' '-j1'
    

    When I was setting this up, I didn't notice the version. So I replaced the homepage URL without replacing the version, which resulted in another exception when it tried to get the archive, because 1.5.7 doesn't exist in this repo. I bumped the version as well, re-build, and:

    [ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
    /usr/bin/clang++  -D_GLIBCXX_USE_CXX11_ABI=1 -I/root/.conan/data/IXWebSocket/5.0.0/IXWebSockets/stable/package/2d89e03e00941cc4186fea9b793094a560d9fb7b/include -I/root/.conan/data/OpenSSL/1.1.1b/conan/stable/package/e93595837cd71d31cd792a7899549d9f13bcd0cc/include -I/root/.conan/data/zlib/1.2.11/conan/stable/package/6d87124bcf4cc4435e13c44634d61b77404bef31/include  -m64 -stdlib=libstdc++ -O3 -DNDEBUG    -std=gnu++1z -o CMakeFiles/test_package.dir/test_package.cpp.o -c /programming/conan-IXWebSocket/test_package/test_package.cpp
    /programming/conan-IXWebSocket/test_package/test_package.cpp:23:30: error: no member named 'WebSocket_MessageType_Message' in namespace 'ix'
          if (messageType == ix::WebSocket_MessageType_Message) {
                             ~~~~^
    /programming/conan-IXWebSocket/test_package/test_package.cpp:24:14: error: no member named 'cout' in namespace 'std'
            std::cout << str << std::endl;
            ~~~~~^
    /programming/conan-IXWebSocket/test_package/test_package.cpp:24:34: error: no member named 'endl' in namespace 'std'
            std::cout << str << std::endl;
                                ~~~~~^
    /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5: error: no viable conversion from '(lambda at /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5)' to 'const ix::OnMessageCallback'
          (aka 'const function<void (const shared_ptr<ix::WebSocketMessage> &)>')
        [](ix::WebSocketMessageType messageType,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_function.h:421:7: note: candidate constructor not viable: no known conversion from '(lambda at /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5)' to
          'std::nullptr_t' (aka 'nullptr_t') for 1st argument
          function(nullptr_t) noexcept
          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_function.h:432:7: note: candidate constructor not viable: no known conversion from '(lambda at /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5)' to
          'const std::function<void (const std::shared_ptr<ix::WebSocketMessage> &)> &' for 1st argument
          function(const function& __x);
          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_function.h:441:7: note: candidate constructor not viable: no known conversion from '(lambda at /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5)' to
          'std::function<void (const std::shared_ptr<ix::WebSocketMessage> &)> &&' for 1st argument
          function(function&& __x) noexcept : _Function_base()
          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_function.h:465:2: note: candidate template ignored: substitution failure
          [with _Functor = (lambda at /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5), $1 = void]: no type named 'type' in 'std::result_of<(lambda at /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5) &(const
          std::shared_ptr<ix::WebSocketMessage> &)>'
            function(_Functor);
            ^
    /programming/conan-IXWebSocket/test_package/test_package.cpp:17:5: note: candidate function
        [](ix::WebSocketMessageType messageType,
        ^
    /root/.conan/data/IXWebSocket/5.0.0/IXWebSockets/stable/package/2d89e03e00941cc4186fea9b793094a560d9fb7b/include/ixwebsocket/IXWebSocket.h:80:60: note: passing argument to parameter 'callback' here
            void setOnMessageCallback(const OnMessageCallback& callback);
                                                               ^
    4 errors generated.
    CMakeFiles/test_package.dir/build.make:65: recipe for target 'CMakeFiles/test_package.dir/test_package.cpp.o' failed
    make[2]: *** [CMakeFiles/test_package.dir/test_package.cpp.o] Error 1
    make[2]: Leaving directory '/programming/conan-IXWebSocket/test_package/build/47edf16f7c6208a569a5a85106a6734e405b9db6'
    CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/test_package.dir/all' failed
    make[1]: *** [CMakeFiles/test_package.dir/all] Error 2
    make[1]: Leaving directory '/programming/conan-IXWebSocket/test_package/build/47edf16f7c6208a569a5a85106a6734e405b9db6'
    Makefile:86: recipe for target 'all' failed
    make: *** [all] Error 2
    ERROR: IXWebSocket/5.0.0@IXWebSockets/stable (test package): Error in build() method, line 15
            cmake.build()
            ConanException: Error 512 while executing cmake --build '/programming/conan-IXWebSocket/test_package/build/47edf16f7c6208a569a5a85106a6734e405b9db6' '--' '-j1'
    

    I also actually can't find some of these fields in the fork. The new variant (WebSocketMessageType, as outlined in the readme of this project) at least exists in this repo. The file in question also only exists here - I can't find either of these in the repo the recipe points to.

    Also, off the top of my head, this will probably fail (if that's an actual concept - I'm not that familiar with developing Conan recipes myself), because not everyone happens to have a websocket server at localhost:8080 running.

    So for the hell of it, I used my fixed package to test. I used the example using localhost:8080 on the main site, with the imports:

    #include <iostream>
    #include <ixwebsocket/IXWebSocket.h>
    #include <ixwebsocket/IXSocket.h>
    #include <ixwebsocket/IXWebSocketMessageType.h>
    

    as well as the conan package I built and a basic CMakeLists.txt I pretty much borrowed from the Conan docs. It compiled with no errors.

    But to get there, I had to change the repo, bump the version, and remove the tests (while updating the test could've worked as well, I'm not familiar with the library, or creating conan recipes, so I didn't want to push my luck).

    Could the conan recipe be updated? Pushing it to conan-center as well could be a good idea.

    opened by LunarWatcher 22
  • Uploading files through multipart.

    Uploading files through multipart.

    I'm working on my DisC++ lib and I think I got all the basic http methods done. I just need to work on uploading files. Discord does this via a multipart form.

    You did give me an example in an earlier issue, which I was able to track down. But it doesn't really help me much.

    In that method you use miniDumpBytes which is a string, how would I get the minidump bytes for the files from an ifstream? And what about sending multiple files in one request? If you want to look at the documentation on sending files, its here.

    Thanks for reading!

    bug no-issue-activity 
    opened by SeanOMik 20
  • WebSocket server dies on multiple connection attempts from same client

    WebSocket server dies on multiple connection attempts from same client

    Major conclustion: The situation is worse than we thought Initially.. I thought this to be a result of trying to close the socket within the setOnConnectionCallback() method. The reality is that if we have a client constantly trying to open new sockets the server throws and dies within a few seconds.

     _onMessageCallback(
                std::make_unique<WebSocketMessage>(WebSocketMessageType::Open,
                                                   "",
                                                   0,
                                                   WebSocketErrorInfo(),
                                                   WebSocketOpenInfo(status.uri, status.headers),
                                                   WebSocketCloseInfo()));
    

    What we initially thought: Situation: the client (Chrome) is invoking multiple socket instances. When we decide to close within setOnConnectionCallback() the server 'explodes' at the above line.

    It occurs within setOnConnectionCallback() i.e. we want to limit the number of active connections from a single IP thus send error MSG and close the socket right within the onConnectionCallback

    Update: I read up (by looking at an example) within documentation that stop() is used is used instead of close(), still close is a public method.What's the difference? When using stop() the result is the same.

    end()/close() executes, then webSocketServer's handleConnection() kicks in, and throws at connectToSocket(), the socket param is null and timout -3.

    opened by rafalsk 19
  • Add support for supplying SSL CA from memory

    Add support for supplying SSL CA from memory

    Heyo,

    I'm using IXWebSocket with a websocket service that's over HTTPS. The service uses letsencrypt, and on platforms like macOS and iOS, it works perfectly. The system Security.framework can verify the certificate using the system's trusted CAs.

    However, on Windows, it fails to verify the chain. As far as I know, mbedtls and openssl do not have the ability to automatically load system trusted CAs on Windows. My project already compiles a static version of openssl, so on non-Apple platforms, I'm using USE_OPENSSL instead of mbed_tls.

    I'd love to implement an API on IXSocketTLSOptions that allows you to specify a CA or cert/key pair from memory. I'm happy to write the implementation for this. I figured I'd write up a github issue in case you have any opinions on how I should go about implementing it.

    Max

    opened by maxweisel 18
  • android can not recieve message

    android can not recieve message

    I make a dll for unity3d , It works fine on windows , But Not ok on android . the url is "wss://xxxx:“。 ” , I track the code, final I get the error in the "IXNetSystem.cpp" ::poll(fds, nfds, timeout); the function always return -1 and the errorno is alaways 4. how can I fixed , forgive my pool english

    opened by shiliupingGitHub 17
  • If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry.

    If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry.

    I'm using an IXWebSocket object. When my application is ready to shut down, I call stop() on the socket object. When the connection is open, this works perfectly. However, if the connection has been severed, IXWebSocket blocks until the next retry attempt which can be up to 10 seconds.

    Steps to reproduce:

    1. Create an IXWebSocket object, call setURL with any URL that is unreachable, and call start()
    2. IXWebSocket will begin retrying with exponential backoff. Once it hits 10 seconds, call stop() immediately after a failed retry.
    3. Observe that stop() will block for 10 seconds until a retry occurs.

    I did some digging, and it seems stop() blocks on _thread.join(). Personally, I still want to keep stop() synchronous. I don't think that's the issue. It seems the issue is that the thread that IXWebSocket uses is blocked while waiting to try to reconnect.

    Any recommendations here? I'm happy to create a fix and open a PR, but I'm not familiar enough with IXWebSocket to know what approach would be in-line with how you've designed the library.

    Max

    opened by maxweisel 16
  • HTTP should contain port in 'Host' header

    HTTP should contain port in 'Host' header

    For connection like "http://localhost:8180/" we need send the host name with the port. For more info see https://www.rfc-editor.org/rfc/rfc9110.html#name-host-and-authority

    opened by Vol-Alex 0
  • Prevent deadlock when the server is stopping

    Prevent deadlock when the server is stopping

    During my tests, I like to start and stop a WebSockets server inside an infinite loop. However, sometimes the loop stops.

    I think the problem lies in _conditionVariableGC. We use this condition variable to notify the runGC thread that something has to be "garbage collected". I think the deadlock happens when we notify the condition variable when the runGC is not yet waiting for the condition variable. To prevent this, I use the boolean member _canContinueGC to "buffer" the notification. If we want to notify runGC while it's not waiting, we can just set _canContinueGC to true and runGC will know that we called notify_one. After runGC has checked _canContinueGC, it resets it to false.

    You can easily reproduce the deadlock with this code:

    int port = getFreePort();
    int count = 0;
    while(true) {
        std::cout << count++ << std::endl;
        ix::WebSocketServer server(port);
        REQUIRE(server.listen().first);
        server.start();
    }
    
    opened by itytophile 0
  • Can't connect to wss endpoint

    Can't connect to wss endpoint

    Hello,

    I am trying IXWEbSocket sample code and I setup server and client successfully. The client tries to connect to server at wss endpoint "wss://localhost:8008", but I am getting this error from the server:

    $./IXWebSocketServer /IXWebSocketServer WebSocketServer::handleConnection() HTTP status: 400 error: Invalid HTTP method, need GET, got

    I am attaching IXWebSocket client and server sample code.

    Sample code works well when I use ws endpoint "ws://localhost:8008".

    I used also this Javascript client main_client.docx main_server.docx to connect to the IXWebSocket server:

    https://www.lddgo.net/en/network/websocket

    and it works with ws endpoint "ws://localhost:8008", but not with a wss one "wss://localhost:8008".

    I build the library with these options on Ubuntu 20.04 LTS:

    $ cmake -DUSE_TLS=1 -DUSE_ZLIB=0 -DUSE_WS=1 -DUSE_TEST=1 -DUSE_OPEN_SSL=1 ..

    I appreciate help

    opened by fkaduch 0
  • Is WebSocketServer::stop sound?

    Is WebSocketServer::stop sound?

    https://github.com/machinezone/IXWebSocket/blob/679ce519dd0d6d3919990abdee7109a5eeb99aa0/ixwebsocket/IXWebSocketServer.cpp#L41

    Hi, I sometimes have a bad_function_call exception when the server is closing. You can try with this code:

    while(true) {
        ix::WebSocketServer server(8080);
        server.disablePerMessageDeflate();
        server.setOnClientMessageCallback([](std::shared_ptr<ConnectionState>, ix::WebSocket &, const std::unique_ptr<WebSocketMessage> &) {});
        REQUIRE(server.listen().first);
        server.start();
        ix::WebSocket webSocket;
        std::string url("ws://localhost:8080/");
        webSocket.setUrl(url);
        webSocket.disablePerMessageDeflate();
        std::mutex mutex;
        mutex.lock();
        webSocket.setOnMessageCallback([&](const ix::WebSocketMessagePtr& msg) { mutex.unlock(); });
        webSocket.start();
        mutex.lock();
    }
    

    This code can cause a deadlock (I don't know why), if it does just restart the test. After maybe 5 attempts you'll get the bad_function_call exception. The debugger I use (CLion) highlights the line 52 after the exception (the end of WebSocketServer::stop).

    In the function I can see that we call getClients. getClients locks a mutex before returning the set containing the clients. However, the lock is dropped at the end of the function. So when WebSocketServer::stop actually uses clients, data races can occur.

    Thanks!

    opened by itytophile 4
  • How to fix

    How to fix "OpenSSL failed - error:0A000086:SSL routines::certificate verify failed"

    Hello. Sorry to post here, but maybe you will be able to tell we what to look to fix my problem.

    Details

    I am using the IXWebSocket client example and I try to open a connection to a nodejs https/websocket server but the client refuses to connect and returns the error : OpenSSL failed - error:0A000086:SSL routines::certificate verify failed

    What I tried

    I tried many things:

    1. I have a React front end using wss websocket to communicate to my https nodejs server. This works.

    2. I compiled IXWebSocket without openSSL. The IXWebSocket client without tlsOptions, is connecting to my same nodejs server, http/websocket (non secure). It works.

    3. I compiled IXWebSocket with openSSL. It was a bit more challenging. I followed the instructions to compile OpenSSL, and then I used scons to compile IXWebSocket, with IXWEBSOCKET_USE_OPEN_SSL and IXWEBSOCKET_USE_TLS flags enable. Everything compile. Then I compiled the little example client with ixwebsocket.lib, libssl.lib,libcrypto.lib,Ws2_32, Crypt32, and Shlwapi. Everything looks fine, but the client returns the error mention above. I followed the instruction here to set the tlsOption.

       ix::SocketTLSOptions tlsOptions;
        tlsOptions.certFile = "WebRTC.test.crt";
        tlsOptions.keyFile = "WebRTC.test.key";
        tlsOptions.caFile = "WebRTC-CA.pem";   //Also, I am not sure the .pem is necessary here. 
        webSocket.setTLSOptions(tlsOptions);
        std::string url("wss://localhost:8080");
        //std::string url("wss://echo.websocket.org");
        webSocket.setUrl(url);
    

    Because number one above works, I think my key and my certificate are correct.. Would it be possible that the problem is the result of the compilation of openSSL is incorrect and IXWebSocket fails because of that?

    EDIT

    Here is my command line to build the websocket client

    cl /Fobuild\fwk\webrtc\testWebSocketClient\MSVC14.1\x86_64\debug\testWebSocketClient.obj /c fwk\webrtc\testWebSocketClient\testWebSocketClient.cpp /TP /FC /nologo /Od /D_DEBUG /EHsc /RTC1 /MTd /IC:\SVN\3rdParty\3rdPartyPackages\IXWebSocket-11.4.3 /Z7 /Fdbuild\fwk\webrtc\testWebSocketClient\MSVC14.1\x86_64\debug\testWebSocketClient.obj.pdb
    testWebSocketClient.cpp
    link /INCREMENTAL /DEBUG /NOLOGO /MACHINE:X64 /OUT:build\fwk\webrtc\testWebSocketClient\MSVC14.1\x86_64\debug\testWSClient.exe /LIBPATH:C:\SVN\3rdParty\3rdPartyPackages\IXWebSocket-11.4.3\MSVC14.1\x86_64\debug /LIBPATH:C:\SVN\3rdParty\3rdPartyPackages\openssl-3.0.7 Ws2_32.lib Crypt32.lib Shlwapi.lib ixwebsocket.lib libssl.lib libcrypto.lib /PDB:build\fwk\webrtc\testWebSocketClient\MSVC14.1\x86_64\debug\testWSClient.exe.pdb /DEBUG build\fwk\webrtc\testWebSocketClient\MSVC14.1\x86_64\debug\testWebSocketClient.obj
    LINK : build\fwk\webrtc\testWebSocketClient\MSVC14.1\x86_64\debug\testWSClient.exe not found or not built by the last incremental link; performing full link
    

    EDIT 2

    I am wondering if it is normal that SSL_OP_NO_TLSv1_3 is defined for me. Who is setting this define?

    #ifdef SSL_OP_NO_TLSv1_3
                // (partially?) work around hang in openssl 1.1.1b, by disabling TLS V1.3
                // https://github.com/openssl/openssl/issues/7967
                options |= SSL_OP_NO_TLSv1_3;
    #endif
                SSL_CTX_set_options(ctx, options);
            }
            return ctx;
        }
    

    Any ideas how to debug this is welcome. Thank you.

    opened by peterphonic 7
  • arm cross compilation - not able to find <stdlib.h> or <math.h> with $make -j

    arm cross compilation - not able to find or with $make -j

    I was successful to complete build process and test a sample program on an Ubuntu 18.04 machine with the following commands:

    cmake -DUSE_TLS=1 -DUSE_OPENSSL=1 .. 
    make -j
    make install 
    

    Later, I tried to cross compile the same for an arm development board (imxul processor) using a Toolchain that was provided by vendor (Phytec). I've imported the environment in a terminal and then issued the commands above. cmake command was successful. make -j command has thrown tens of errors as shown below although stdlib.h is present in the same path as cstdlib It could find the file cstdlib but failed to find stdlib.h which is in the same path.

    I'm really not sure if this a problem with toolchain but posting here as I couldn't find help elsewhere. And, sorry for the lenghty post, you may ignore most of pasted error log. Most of these error messages are repeated. Please let me know if I need to supply more information.

    cstdlib:75:15: fatal error: stdlib.h: No such file or directory #include_next <stdlib.h> ^~~~~~~~~~ compilation terminated.

    In my terminal echo $PATH for arm is:

    /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/usr/bin/qt5:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/usr/bin:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/usr/sbin:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/bin:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/sbin:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/usr/bin/../x86_64-phytecsdk-linux/bin:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/usr/bin/arm-phytec-linux-gnueabi:/opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/x86_64-phytecsdk-linux/usr/bin/arm-phytec-linux-musl:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

    Complete error message for "make all":

    gmk@dell-G15-5511:~/phytec_project/ocpp_test/github_machinezone_arm/build$ make all [ 2%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXBench.cpp.o In file included from /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/ext/string_conversions.h:41:0, from /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/bits/basic_string.h:6349, from /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/string:52, from /home/gmk/phytec_project/ocpp_test/github_machinezone_arm/ixwebsocket/IXBench.h:10, from /home/gmk/phytec_project/ocpp_test/github_machinezone_arm/ixwebsocket/IXBench.cpp:7: /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory #include_next <stdlib.h> ^~~~~~~~~~ compilation terminated. CMakeFiles/ixwebsocket.dir/build.make:62: recipe for target 'CMakeFiles/ixwebsocket.dir/ixwebsocket/IXBench.cpp.o' failed make[2]: *** [CMakeFiles/ixwebsocket.dir/ixwebsocket/IXBench.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ixwebsocket.dir/all' failed make[1]: *** [CMakeFiles/ixwebsocket.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

    Complete error message for "make -j":

    gmk@dell-G15-5511:~/phytec_project/ocpp_test/github_machinezone_arm/build$ make -j [ 7%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXConnectionState.cpp.o [ 7%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXCancellationRequest.cpp.o [ 7%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXBench.cpp.o [ 10%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXDNSLookup.cpp.o [ 13%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXExponentialBackoff.cpp.o [ 15%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXGetFreePort.cpp.o [ 18%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXGzipCodec.cpp.o [ 21%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttp.cpp.o [ 23%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpClient.cpp.o [ 26%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpServer.cpp.o [ 28%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXNetSystem.cpp.o [ 31%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptFactory.cpp.o [ 34%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptPipe.cpp.o [ 36%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterrupt.cpp.o [ 39%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSetThreadName.cpp.o [ 42%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocket.cpp.o In file included from /home/gmk/phytec_project/ocpp_test/github_machinezone_arm/ixwebsocket/IXExponentialBackoff.cpp:9:0: /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/cmath:45:15: fatal error: math.h: No such file or directory #include_next <math.h> ^~~~~~~~ [ 47%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSelectInterruptEvent.cpp.o [ 47%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketHandshake.cpp.o [ 50%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketHttpHeaders.cpp.o compilation terminated. [ 52%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketTLSOptions.cpp.o CMakeFiles/ixwebsocket.dir/build.make:158: recipe for target 'CMakeFiles/ixwebsocket.dir/ixwebsocket/IXExponentialBackoff.cpp.o' failed make[2]: *** [CMakeFiles/ixwebsocket.dir/ixwebsocket/IXExponentialBackoff.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... [ 76%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketFactory.cpp.o [ 78%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp.o [ 55%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketConnect.cpp.o [ 57%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketServer.cpp.o [ 63%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUuid.cpp.o [ 63%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketCloseConstants.cpp.o [ 65%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUdpSocket.cpp.o [ 71%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXUrlParser.cpp.o [ 73%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp.o [ 81%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketProxyServer.cpp.o In file included from /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/ext/string_conversions.h:41:0, from /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/bits/basic_string.h:6349, from /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/string:52, from /home/gmk/phytec_project/ocpp_test/github_machinezone_arm/ixwebsocket/IXSetThreadName.h:7, from /home/gmk/phytec_project/ocpp_test/github_machinezone_arm/ixwebsocket/IXSetThreadName.cpp:6: /opt/phytec-yogurt/BSP-Yocto-i.MX6UL-PD19.1.0/sysroots/cortexa7hf-neon-vfpv4-phytec-linux-gnueabi/usr/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory #include_next <stdlib.h> ^~~~~~~~~~ compilation terminated. CMakeFiles/ixwebsocket.dir/build.make:86: recipe for target 'CMakeFiles/ixwebsocket.dir/ixwebsocket/IXCancellationRequest.cpp.o' failed make[2]: *** [CMakeFiles/ixwebsocket.dir/ixwebsocket/IXCancellationRequest.cpp.o] Error 1 CMakeFiles/ixwebsocket.dir/build.make:110: recipe for target 'CMakeFiles/ixwebsocket.dir/ixwebsocket/IXConnectionState.cpp.o' failed make[2]: *** [CMakeFiles/ixwebsocket.dir/ixwebsocket/IXConnectionState.cpp.o] Error 1 [ 97%] Building CXX object CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketOpenSSL.cpp.o CMakeFiles/ixwebsocket.dir/build.make:254: recipe for target 'CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpClient.cpp.o' failed make[2]: *** [CMakeFiles/ixwebsocket.dir/ixwebsocket/IXHttpClient.cpp.o] Error 1 CMakeFiles/ixwebsocket.dir/build.make:518: recipe for target 'CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketServer.cpp.o' failed make[2]: *** [CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketServer.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ixwebsocket.dir/all' failed make[1]: *** [CMakeFiles/ixwebsocket.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

    opened by mgsanava 3
Releases(v11.4.3)
Owner
Machine Zone, Inc.
Machine Zone, Inc.
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.2k Jan 2, 2023
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

Ivan Shynkarenka 958 Jan 3, 2023
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 9k Jan 1, 2023
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

xcyl 29 Dec 17, 2022
H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server

H2O - an optimized HTTP server with support for HTTP/1.x, HTTP/2 and HTTP/3 (experimental) Copyright (c) 2014-2019 DeNA Co., Ltd., Kazuho Oku, Tatsuhi

H2O 10.2k Dec 30, 2022
Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use

What Is RESTinio? RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server. It is based on standalone version of ASIO

Stiffstream 924 Jan 6, 2023
C++ websocket client/server library

WebSocket++ (0.8.2) WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket Protocol. It allows integrating WebSocket client an

Peter Thorson 6k Jan 8, 2023
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line.

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

aria2 28.7k Jan 7, 2023
Small and fast cross-platform networking library, with support for messaging, IPv6, HTTP, SSL and WebSocket.

frnetlib Frnetlib, is a cross-platform, small and fast networking library written in C++. There are no library dependencies (unless you want to use SS

Fred Nicolson 23 Nov 25, 2022
BingBing 60 Dec 15, 2022
HTTP and WebSocket built on Boost.Asio in C++11

HTTP and WebSocket built on Boost.Asio in C++11 Branch Linux/OSX Windows Coverage Documentation Matrix master develop Contents Introduction Appearance

Boost.org 3.6k Jan 4, 2023
Simple embeddable C++11 async tcp,http and websocket serving.

net11 Simple embeddable C++11 async tcp,http and websocket serving. What is it? An easily embeddable C++11 networking library designed to make buildin

Jonas Lund 9 Mar 28, 2020
Gromox - Groupware server backend with MAPI/HTTP, RPC/HTTP, IMAP, POP3 and PHP-MAPI support for grommunio

Gromox is the central groupware server component of grommunio. It is capable of serving as a replacement for Microsoft Exchange and compatibles. Conne

grommunio 139 Dec 26, 2022
A collection of C++ HTTP libraries including an easy to use HTTP server.

Proxygen: Facebook's C++ HTTP Libraries This project comprises the core C++ HTTP abstractions used at Facebook. Internally, it is used as the basis fo

Facebook 7.7k Jan 4, 2023
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Ole Christian Eidheim 2.4k Dec 23, 2022
A Lightweight and fully asynchronous WebSocket client library based on libev

libuwsc(中文) A Lightweight and fully asynchronous WebSocket client library based on libev for Embedded Linux. And provide Lua-binding. Why should I cho

Jianhui Zhao 285 Dec 24, 2022
A C++ header-only HTTP/HTTPS server and client library

cpp-httplib A C++11 single-file header-only cross platform HTTP/HTTPS library. It's extremely easy to setup. Just include the httplib.h file in your c

null 8.3k Dec 31, 2022
Micro http server and client written in C++

httpp Micro http server and client written in C++ The motivation behind this little piece of code is to provide a really simple, yet efficient HTTP se

Thomas Sanchez 158 Nov 28, 2022
WSServer is a fast, configurable, and extendable WebSocket Server for UNIX systems written in C (C11).

WSServer a C WebSocket Server WSServer is a fast, configurable, and extendable WebSocket Server for UNIX systems written in C (C11). As of version 2.0

Morten Houmøller Nygaard 170 Dec 8, 2022