ithewei/libhv
Free🔥 比libevent/libuv/asio更易用的网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket/MQTT client/server.
About ithewei/libhv
libhv is a cross-platform C/C++ network library that provides an event-loop with non-blocking I/O and timers, similar to libevent, libev, and libuv but with a simpler API and richer protocol support. It supports TCP/UDP client/server/proxy with advanced features like heartbeat, reconnect, multi-thread-safe write/close, and built-in unpacking modes (FixedLength, Delimiter, LengthField). It includes SSL/TLS support via OpenSSL, GnuTLS, or mbedTLS, RUDP via KCP, and full HTTP client/server (HTTP/1.x, HTTP/2, gRPC) with static service, indexof service, forward/reverse proxy, RESTful routing, middleware, keep-alive, chunked, SSE, and WebSocket. Additionally, it offers MQTT and Redis clients. The library builds with Makefile, CMake, Bazel, vcpkg, and xmake, and is designed for high performance on Linux, Windows, macOS, Android, iOS, BSD, and Solaris.
Key Features
Pros & Cons
- Simpler and more intuitive API compared to libevent, libev, and asio
- Rich built-in protocol support (HTTP, WebSocket, MQTT, Redis) reducing external dependencies
- True cross-platform compatibility across major operating systems
- Multiple build system options (Makefile, CMake, Bazel, vcpkg, xmake) for easy integration
- High performance with non-blocking I/O and event loop
- Smaller community and ecosystem compared to more established libraries like libuv
- Documentation primarily in Chinese (English README available but less detailed)