When building real-time trading applications in Rust, I encountered a critical gap: no Rust client library existed for Lightstreamer, the industry-standard real-time messaging server used extensively in financial systems, IoT platforms, and live data applications. Rather than compromise the tech stack or implement a suboptimal workaround, I developed a professional-grade Rust client SDK and released it as open-source software to benefit the entire Rust community.

The Challenge: Real-Time Data Streaming in Rust
What is Lightstreamer?
Lightstreamer - Industry-standard real-time messaging server
Lightstreamer is a high-performance real-time messaging server that powers mission-critical applications across multiple industries:
Key Use Cases:
- Financial Markets - Live stock quotes, options chains, trading data
- IoT Systems - Sensor telemetry, device monitoring, real-time control
- Aerospace - NASA uses Lightstreamer for ISS telemetry streaming
- Gaming - Multiplayer game state synchronization
- Live Updates - News feeds, social media streams, collaborative applications
Technical Capabilities:
- Full-duplex WebSocket connections for bidirectional communication
- Multiple transport protocols (WebSocket, HTTP streaming, long polling)
- Bandwidth optimization with dynamic throttling and event consolidation
- Automatic connection recovery and resilience
- Multiple subscription modes (MERGE, DISTINCT, COMMAND, RAW)
The Gap in the Rust Ecosystem
Lightstreamer provides official client libraries for:
- ✅ JavaScript/TypeScript
- ✅ Java
- ✅ .NET
- ✅ Python
- ✅ Objective-C/Swift
- ❌ Rust - NONE
The Problem: Modern high-performance applications increasingly choose Rust for its exceptional concurrency, memory safety, and zero-cost abstractions. However, without a Rust client for Lightstreamer, developers faced a difficult choice:
- Use a different language for the Lightstreamer integration (adding complexity)
- Implement a custom client from scratch (expensive, time-consuming)
- Use an alternative messaging system (may not meet requirements)
- Abandon Rust for this use case (losing Rust’s benefits)
None of these options were acceptable for professional applications requiring both Rust’s performance guarantees and Lightstreamer’s proven real-time capabilities.
The Solution: A Professional Rust SDK
I developed lightstreamer-client, a comprehensive Rust SDK implementing Lightstreamer’s Text-based Live Connections Protocol (TLCP). The library provides a type-safe, asynchronous API that feels natural to Rust developers while maintaining full compatibility with Lightstreamer servers.
Architecture and Design Decisions
Core Technologies:
| Component | Technology | Purpose |
|---|---|---|
| Async Runtime | Tokio | Non-blocking I/O and task scheduling |
| WebSocket | tokio-tungstenite | Full-duplex communication |
| Serialization | serde/serde_json | Type-safe data handling |
| HTTP Client | reqwest | Session creation and control requests |
| Error Handling | Custom error types | Comprehensive error reporting |
Key Technical Decisions
1. Async-First Design
The SDK is built on Tokio, Rust’s most popular async runtime:
Benefits:
- Non-blocking operations for maximum throughput
- Efficient handling of multiple concurrent subscriptions
- Natural integration with async Rust applications
- Minimal resource overhead
2. Type-Safe API
Leveraging Rust’s type system for compile-time guarantees:
pub struct LightstreamerClient {
server_address: String,
adapter_set: String,
// ... internal state
}
impl LightstreamerClient {
pub fn new(
server_address: Option<&str>,
adapter_set: Option<&str>,
username: Option<&str>,
password: Option<&str>,
) -> Result<Self, LightstreamerError> {
// Validation and construction
}
pub async fn connect(&self, options: Option<ConnectionOptions>)
-> Result<(), LightstreamerError> {
// Establish connection
}
}
Advantages:
- Compile-time prevention of invalid configurations
- Clear API documentation through types
- IDE autocompletion and inline documentation
- Zero runtime overhead
3. Subscription Management
Flexible subscription system supporting all Lightstreamer modes:
pub struct Subscription {
mode: SubscriptionMode,
items: Option<Vec<String>>,
fields: Option<Vec<String>>,
// ... additional configuration
}
pub enum SubscriptionMode {
Merge,
Distinct,
Raw,
Command,
}
Features:
- Multiple simultaneous subscriptions
- Dynamic subscription modification
- Automatic state management
- Event-driven updates
Features and Capabilities
1. Full Protocol Implementation
Connection Management:
- WebSocket-based full-duplex connections
- Automatic session creation and management
- Connection options configuration
- Proxy support
- Connection lifecycle events
Subscription Modes:
- MERGE - Latest values for each item/field combination
- DISTINCT - Every update delivered in sequence
- RAW - Unfiltered data stream
- COMMAND - Special mode for keyed data (add/update/delete)
Real-Time Updates:
- Item update events with field values
- Subscription status notifications
- Connection state changes
- Error handling and recovery
2. Production-Ready Features
3. Real-World Application: Financial Trading
This SDK was developed to support real-time trading applications requiring professional-grade data streaming capabilities.
Requirements:
- Real-time streaming of options market data
- Thousands of simultaneous option contract subscriptions
- Sub-second latency for price updates
- Reliable connection handling with automatic recovery
- Efficient bandwidth utilization
Results: The Lightstreamer Rust client successfully powers real-time data streaming in production trading applications, handling:
- Multiple concurrent subscriptions to different instruments
- High-frequency price updates with minimal latency
- Automatic reconnection on network interruptions
- Efficient resource utilization
Related Project
This SDK was specifically developed to support the IG Trading API Rust Client, a high-performance real-time trading application that leverages Lightstreamer for live market data streaming.
View the IG Trading API projectOpen Source Contribution
Why Open Source?
Although developed for a confidential client project, I made the strategic decision to release this library as open-source software for several compelling reasons:
1. Community Benefit
- Fills a critical gap in the Rust ecosystem
- Enables more developers to build with Rust + Lightstreamer
- Reduces duplication of effort across projects
2. Quality Through Collaboration
- Community code review improves quality
- Bug reports and contributions enhance reliability
- Broader testing across diverse use cases
3. Industry Advancement
- Promotes Rust adoption in real-time applications
- Establishes best practices for TLCP implementation
- Provides reference implementation for protocol details
Publication and Availability
Published on crates.io:
- Package:
lightstreamer-client - Installation:
cargo add lightstreamer-client - Documentation: docs.rs/lightstreamer-client

Open Source Repository:
- GitHub: github.com/daniloaz/lightstreamer-client
- License: GPL-3.0
- Active development and maintenance
- Community contributions welcome

Usage Example
Here’s a minimal example demonstrating the library’s clean API:
use lightstreamer_client::ls_client::LightstreamerClient;
use lightstreamer_client::subscription::{Subscription, SubscriptionMode};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create client instance
let client = LightstreamerClient::new(
Some("http://push.lightstreamer.com/lightstreamer"),
Some("DEMO"),
None, // username
None, // password
)?;
// Create subscription
let mut subscription = Subscription::new(
SubscriptionMode::Merge,
Some(vec!["item1".to_string(), "item2".to_string()]),
Some(vec!["field1".to_string(), "field2".to_string()]),
)?;
// Subscribe to items
client.subscribe(subscription);
// Connect to server
client.connect(None).await?;
Ok(())
}
Key Features Demonstrated:
- Simple, intuitive API
- Type-safe configuration
- Async/await support
- Minimal boilerplate
Technical Achievements
Future Development
The library provides a solid foundation with room for enhancement:
Current Focus (v0.1.x):
- Core TLCP protocol implementation
- WebSocket transport mode
- MERGE subscription mode
- Essential connection management
- Production stability
Potential Future Enhancements:
- Additional subscription modes (DISTINCT, RAW, COMMAND)
- Alternative transport protocols (HTTP streaming, long polling)
- Advanced bandwidth management
- Connection pooling
- Enhanced retry strategies
- Performance optimizations
Community contributions are welcome for any of these enhancements or other improvements.
Conclusion
The Lightstreamer Rust Client SDK represents a strategic contribution to the Rust ecosystem, enabling developers to build high-performance real-time applications with one of the industry’s leading messaging platforms. By releasing this library as open-source software, I’ve helped bridge a critical gap between Rust’s capabilities and Lightstreamer’s proven technology.
This project demonstrates several key strengths:
- Technical depth in protocol implementation and async Rust
- Strategic thinking in identifying ecosystem gaps
- Community focus through open-source contribution
- Production experience with real-world financial applications
The library is actively maintained and available for any project requiring real-time data streaming with Lightstreamer and Rust.
Need Rust development or real-time systems expertise?
For projects requiring:
- Rust system libraries and SDK development.
- Real-time data streaming integration.
- Financial systems with low-latency requirements.
- WebSocket and async Rust applications.
I bring deep expertise in Rust systems programming, async architectures, and real-time applications. Available for consulting and development on similar high-performance projects.
Get in touch →
About the author
Daniel López Azaña
Tech entrepreneur and cloud architect with over 20 years of experience transforming infrastructures and automating processes.
Specialist in AI/LLM integration, Rust and Python development, and AWS & GCP architecture. Restless mind, idea generator, and passionate about technological innovation and AI.
Related projects

IG.com Rust Client - Open Source SDK for Algorithmic Trading
Professional Rust SDK for IG.com REST and Streaming APIs. First complete Rust client library enabling integration with algorithmic trading platforms, account management, order execution, and real-time market data. Published on crates.io as open-source contribution.

Live Car Auction Platform - Real-Time Bidding System with WebSockets
Full-featured web application for conducting live car auctions simultaneously onsite and online, featuring real-time websocket-based bidding engine, responsive multi-device interface, and comprehensive auction management system built with AngularJS, Symfony, and AWS infrastructure.

GeoWebcams - Intelligent Webcam Discovery Platform
Comprehensive platform combining Python data processing, Rust web applications, and AI-powered workflows to discover, validate, and serve thousands of live webcams from around the world, with advanced geographic search and live streaming capabilities.
Comments
Submit comment