Skip to content

Home

Signal Fish Client SDK

A transport-agnostic Rust client SDK for the Signal Fish multiplayer signaling protocol.

Crates.io docs.rs CI License: MIT MSRV


Key Features

  • Transport-Agnostic — Plug in any transport that implements the Transport trait; swap WebSocket for TCP, QUIC, or a test loopback without changing your game code.
  • Async / Await — Built on Tokio with a fully non-blocking API. Command methods return immediately; events arrive on an async channel.
  • Event-Driven Architecture — All server responses are delivered as strongly-typed SignalFishEvent variants on a bounded mpsc channel — just match in a loop.
  • WebSocket Built-InWebSocketTransport ships out of the box (enabled by default via the transport-websocket feature) so you can connect in one line.
  • Reconnection Support — Gracefully handle disconnects and reconnect to your session without losing context.
  • Spectator Mode — Join rooms as a spectator to observe game state without participating.
  • Configurable — Tune event channel capacity, shutdown timeout, and more via SignalFishConfig builder methods.

Quick Start

Add the crate to your project:

Bash
cargo add signal-fish-client

Then connect, authenticate, and join a room in just a few lines:

Rust
use signal_fish_client::{
    WebSocketTransport, SignalFishClient, SignalFishConfig,
    JoinRoomParams, SignalFishEvent,
};

#[tokio::main]
async fn main() -> Result<(), signal_fish_client::SignalFishError> {
    let transport = WebSocketTransport::connect("wss://example.com/signal").await?;
    let config = SignalFishConfig::new("mb_app_abc123");
    let (mut client, mut event_rx) = SignalFishClient::start(transport, config);

    while let Some(event) = event_rx.recv().await {
        match event {
            SignalFishEvent::Authenticated { app_name, .. } => {
                println!("Authenticated as {app_name}");
                client.join_room(JoinRoomParams::new("my-game", "Alice"))?;
            }
            SignalFishEvent::RoomJoined { room_code, .. } => {
                println!("Joined room {room_code}");
            }
            SignalFishEvent::Disconnected { .. } => break,
            _ => {}
        }
    }

    client.shutdown().await;
    Ok(())
}

Feature flag

WebSocketTransport requires the transport-websocket feature, which is enabled by default. If you disabled default features, re-enable it explicitly:

TOML
signal-fish-client = { version = "0.4.1", features = ["transport-websocket"] }


Explore the Docs

  • Installation & Quick Start


    Install the crate, set up Tokio, and make your first connection in under five minutes.

    Installation & Quick Start

  • Client API Reference


    Configuration, builder methods, and command reference for SignalFishClient.

    Client API Reference

  • Example Walkthroughs


    Walkthroughs of real-world usage patterns — lobby management, custom transports, and more.

    Example Walkthroughs

  • API Docs (docs.rs)


    Auto-generated API documentation with full type signatures and doc comments.

    docs.rs


Resource URL
GitHub Repository Ambiguous-Interactive/signal-fish-client-rust
Guide (GitHub Pages) Signal Fish Client SDK
crates.io signal-fish-client
docs.rs signal-fish-client

Built with :heart: by Ambiguous Interactive