A lightweight, asynchronous WebSocket server implementation using Rust and Tokio.
- Asynchronous WebSocket communication
- Echo server functionality
- Connection management with proper error handling
- Built with Tokio and Tokio-Tungstenite
The following flowchart illustrates the server's operation:
- Rust 2024 edition
- Cargo package manager
Clone the repository and build the project:
git clone https://github.com/LinuxUser255/websocket-server.git
cd websocket-server
cargo build --releaseRun the server:
cargo runThe WebSocket server will start on ws://127.0.0.1:9001.
You can test the server using various WebSocket clients:
- Browser-based clients like WebSocket King
- Command-line tools like websocat
- Write your own WebSocket client
Example with websocat:
websocat ws://127.0.0.1:9001Type messages and they will be echoed back to you.
src/main.rs- Server implementation with connection handlingCargo.toml- Project dependencies and configuration
tokio- Asynchronous runtimetokio-tungstenite- WebSocket implementation for Tokiotungstenite- WebSocket protocol implementationfutures- Utilities for asynchronous programming
