Skip to content

deep-neural/libwebtransport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libwebTransport
libwebtransport

A pure C/C++ implementation of the WebTransport API leveraging QUIC and HTTP/3

libwebTransport
License: MIT


New Release

libwebTransport v1.0.0 has been released! See the release notes to learn about new features, enhancements, and breaking changes.

If you aren’t ready to upgrade yet, check the tags for previous stable releases.

We appreciate your feedback! Feel free to open GitHub issues or submit changes to stay updated in development and connect with the maintainers.


Usage

libwebtransport is distributed as a pure C/C++ library. To integrate it into your project, ensure you have a compatible C/C++ compiler and the necessary build tools (e.g., Make, CMake). Clone the repository and link against the library in your build system.

Simple API

Server Client
#include <web_transport.h>
#include <iostream>

int main() {
    web_transport::Server server("0.0.0.0", 443);
    
    server.setCertFile("./publickey.pem");
    server.setKeyFile("./privatekey.pem");
    
    server.onSession([](void* session_ptr, const std::string& path) {

        auto* session = static_cast<web_transport::ServerSession*>(session_ptr);
        std::cout << "New session on path: " << path << std::endl;

        session->onDatagramRead([session](const std::vector<uint8_t>& data) {
            std::cout << "onDatagramRead: " << data.data() << std::endl;
        });

        return true;
    });
    
    server.initialize();
    server.listen();
    
    return 0;
}
#include <web_transport.h>

int main() {
    web_transport::Client client("https://example.com/path");
    
    client.setPublicKey("./publickey.pem");
    
    client.onSessionOpen([](void* session_ptr) {
        auto* session = static_cast<web_transport::ClientSession*>(session_ptr);
        std::cout << "Session opened!" << std::endl;
        
        // Send a datagram
        session->sendDatagram({1, 2, 3, 4});
    });
    
    client.connect();
    client.runEventLoop();
    
    return 0;
}

Example Applications contain code samples demonstrating common use cases with libwebTransport.

API Documentation provides a comprehensive reference of our Public APIs.

Now go build something amazing! Here are some ideas to spark your creativity:

  • Transfer large files in real-time with QUIC’s low latency and stream multiplexing.
  • Develop a real-time multiplayer game server with ultra-responsive data channels.
  • Create interactive live-streaming applications featuring dynamic data exchange.
  • Implement low-latency remote control and telemetry for embedded and IoT devices.
  • Integrate server push and bidirectional streams for cutting-edge web applications.

Building

See BUILDING.md for building instructions.

Features

WebTransport API

  • Pure C/C++ implementation of the emerging WebTransport API for bidirectional data streams.
  • Supports both reliable and unreliable data delivery modes.
  • Enables server push, stream multiplexing, and efficient session management.

QUIC & HTTP/3 Powered Connectivity

  • Built on QUIC—harnessing features like 0-RTT connection establishment and connection migration.
  • Leverages HTTP/3 for reduced latency, improved congestion control, and robust performance.
  • Multiplexed streams allow concurrent data transfers without head-of-line blocking.

Data Streams

  • Bidirectional and unidirectional streams for flexible data transfer.
  • Offers ordered and unordered delivery options to suit various application needs.
  • Customizable stream priorities and flow control mechanisms.

Security

  • Utilizes TLS 1.3 integrated within QUIC for state-of-the-art encryption.
  • Provides end-to-end secure data channels with advanced protection against network threats.

Pure C/C++

  • Written entirely in C/C++ with no external dependencies beyond standard libraries.
  • Wide platform support: Windows, macOS, Linux, FreeBSD, and more.
  • Optimized for high performance with fast builds and a comprehensive test suite.
  • Easily integrated into existing projects using common build systems.

Contributing

Check out the contributing guide to join the team of dedicated contributors making this project possible.

License

MIT License - see LICENSE for full text