titanium-gateway 0.1.1

High-performance Discord Gateway WebSocket client
Documentation

Titan Gateway - High-performance Discord Gateway WebSocket client

This crate provides a robust WebSocket client for Discord's Gateway API, designed for bots scaling to 1M+ guilds.

Features

  • Zero-copy JSON parsing with optional SIMD acceleration
  • ETF (Erlang Term Format) support for smaller payloads
  • Automatic heartbeat management
  • Session resumption support
  • Cluster-native shard management
  • Strict error handling (no unwrap)

Cargo Features

  • simd - Enable SIMD-accelerated JSON parsing (~2-3x faster on supported CPUs)
  • etf - Enable Erlang Term Format encoding (more compact than JSON)

Example

use titanium_gateway::{Shard, ShardConfig};
use titanium_model::Intents;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ShardConfig::new("your-token", Intents::default());
    let mut shard = Shard::new(0, 1, config);
    
    let (event_tx, event_rx) = flume::unbounded();
    shard.run(event_tx).await?;
    
    Ok(())
}