libhv is a C/C++ network library for building TCP/UDP/SSL/HTTP/WebSocket/MQTT/Redis client and server applications.
The tool addresses the complexity of event-driven network programming by providing a simpler API than libevent, libev, or libuv while supporting a broader range of protocols. It implements a high-performance event loop handling IO, timers, idle callbacks, and signals, with built-in support for common message unpacking modes including fixed-length, delimiter-based, and length-field formats. The library abstracts away platform differences across Linux, Windows, macOS, Android, iOS, BSD, and Solaris through a unified interface.
Developers should choose this tool if they need straightforward protocol support without the learning curve of lower-level event libraries. It suits projects requiring HTTP servers with features like static file serving, reverse proxying, middleware, chunked transfer, and server-sent events; WebSocket communication; MQTT client functionality; or Redis client operations. The HTTP client API follows Python requests conventions, while the server API mirrors Go's gin framework, making it accessible to developers familiar with those ecosystems. For those evaluating alternatives, the README explicitly positions libhv as simpler than libevent, libev, and libuv while offering richer built-in protocol support.
The project maintains active development with regular commits across multiple build systems including Makefile, CMake, Bazel, vcpkg, and xmake. Examples span both C and C++ implementations, covering TCP/UDP servers and clients, HTTP and WebSocket services, Redis operations, MQTT messaging, and proxy servers. The codebase includes multi-threaded patterns demonstrating acceptor-worker thread pools and multi-process configurations. Optional features like KCP support, multiple TLS backends, and Redis functionality can be enabled at build time, indicating a modular approach to dependencies.