json-poller
A lightweight, flexible, high-performance JSON polling library for Rust.
Features
- Automatic connection reuse (no TCP/TLS handshake overhead)
- High-performance polling with configurable intervals
- Works with any struct that implements
serde::Deserialize - Async callbacks for flexible data processing
Installation
Add to your Cargo.toml:
[]
= "0.2.0"
= { = "1", = ["full"] }
= { = "1.0", = ["derive"] }
Or install directly from GitHub:
[]
= { = "https://github.com/erik404/json-poller" }
= { = "1", = ["full"] }
= { = "1.0", = ["derive"] }
Configuration
let poller = builder
.poll_interval_ms // How often to poll (default: 500ms)
.request_timeout_ms // Request timeout (default: 1000ms)
.pool_max_idle_per_host // Connections to keep alive (default: 1)
.pool_idle_timeout_secs // How long to keep connections (default: 90s)
.tcp_keepalive_secs // TCP keepalive interval (default: 60s)
.build?;
Usage
use JsonPoller;
use Deserialize;
async
Requirements
- Works with any type that implements
serde::Deserialize - Requires
tokioasync runtime - Only supports JSON responses
License
MIT OR Apache-2.0