socketio_client

Crates.iosocketio_client
lib.rssocketio_client
version0.1.0
created_at2025-12-23 04:21:21.287977+00
updated_at2025-12-23 04:21:21.287977+00
descriptionSocket.IO client implementation with Engine.IO protocol version 3 support (socket.io-client@2.5.0 Rust port)
homepage
repositoryhttps://github.com/an1by/socketio_client
max_upload_size
id2000736
size131,915
An1by (an1by)

documentation

https://docs.rs/crate/socketio_client

README

Rust Socket.IO Client v3

Rust implementation of Socket.IO client with support for Engine.IO protocol version 3 (EIO=3).

Features

  • ✅ Engine.IO protocol version 3 support
  • ✅ WebSocket transport
  • ✅ Automatic reconnection
  • ✅ Event handling (emit/on)
  • ✅ Namespace support
  • ✅ Acknowledgment support

Usage

use rust_socketio_v3::{connect, ManagerOptions};
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create connection
    let manager = connect("http://localhost:3000")?;

    // Get socket for namespace
    let socket = manager.socket("/").await;

    // Subscribe to events
    socket.on("message", |data| {
        println!("Received: {:?}", data);
    });

    // Connect
    socket.connect().await?;

    // Emit event
    socket.emit("chat", vec![json!({"message": "Hello!"})]).await?;

    // Keep connection open
    tokio::time::sleep(tokio::time::Duration::from_secs(60)).await;

    Ok(())
}

Protocol

The library supports Engine.IO version 3 (EIO=3), which ensures compatibility with Socket.IO servers version 2.x.

License

MIT

Commit count: 0

cargo fmt