#tokio-tungstenite #real-time #tungstenite

armature-websocket

WebSocket server and client support for Armature using tokio-tungstenite

2 unstable releases

Uses new Rust 2024

0.2.0 Dec 29, 2025
0.1.0 Dec 27, 2025

#4 in #tungstenite


Used in armature-collab

Apache-2.0

73KB
1.5K SLoC

Armature WebSocket

WebSocket server and client support for the Armature framework using tokio-tungstenite.

Features

  • WebSocket server with connection management
  • WebSocket client for outbound connections
  • Room-based message broadcasting
  • Connection state management
  • Heartbeat/ping-pong support
  • JSON message serialization

Example

use armature_websocket::{WebSocketServer, WebSocketHandler, Message};
use async_trait::async_trait;

struct ChatHandler;

#[async_trait]
impl WebSocketHandler for ChatHandler {
    async fn on_connect(&self, connection_id: &str) {
        println!("Client connected: {}", connection_id);
    }

    async fn on_message(&self, connection_id: &str, message: Message) {
        println!("Received from {}: {:?}", connection_id, message);
    }

    async fn on_disconnect(&self, connection_id: &str) {
        println!("Client disconnected: {}", connection_id);
    }
}

Dependencies

~15–35MB
~432K SLoC