#server #await #wynd

wynd

An attempt to make a websocket server in rust

2 releases

Uses new Rust 2024

new 0.1.1 Mar 30, 2025
0.1.0 Mar 26, 2025

#160 in WebSocket

Download history 97/week @ 2025-03-23

97 downloads per month

MIT/Apache

11KB
123 lines

Wynd

A user friendly WebSocket server written in Rust

"This is an experimental project, and its development may change over time."

Please star the repo if you like it, so that I know someone is using it.

Table of Contents


Overview

Wynd is a user friendly WebSocket server written in Rust.

Goals

  • Provide an intuitive and simple API like WS in javascript.
  • Focus on developer experience first; performance optimizations will come later
  • Prioritize ease of use over low-level control initially

Installation

You can add wynd to your project using Cargo:

cargo add wynd tokio

Or manually add it to your Cargo.toml:

[dependencies]
wynd = "0.1.1"
tokio = { version = "1.44.0", features = ["full"] }

Basic Example

use wynd::wynd::Server;

#[tokio::main]
async fn main() {
    let mut wynd = Server::new(8080);

    wynd.on_connection(|mut conn| {
        println!("Client connected");

        conn.on_message(|_event, conn| {
            let conn = conn.clone();

            tokio::spawn(async move {
                conn.send("hehe").await;
            });
        });
    });

    wynd.listen().await.unwrap();
}

Documentation

Changelog

View Changelog

Dependencies

~7–16MB
~175K SLoC