#server #await #wynd

wynd

An attempt to make a websocket server in rust

3 releases

Uses new Rust 2024

0.1.2 Mar 30, 2025
0.1.1 Mar 30, 2025
0.1.0 Mar 26, 2025

#158 in WebSocket

Download history 100/week @ 2025-03-23 230/week @ 2025-03-30

330 downloads per month

MIT/Apache

13KB
161 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.2"
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();
}

View full blown code examples here.

Documentation

Getting Started Guide

Changelog

View Changelog

Dependencies

~7–15MB
~178K SLoC