fake-socket

Crates.iofake-socket
lib.rsfake-socket
version0.2.0
sourcesrc
created_at2022-01-22 19:25:21.102255
updated_at2022-02-13 20:24:26.081252
descriptionA simple fake socket for testing purpose.
homepagehttps://github.com/tyrchen/utility-belt
repositoryhttps://github.com/tyrchen/utility-belt
max_upload_size
id519277
size6,071
Tyr Chen (tyrchen)

documentation

https://docs.rs/fake-socket

README

Fake Socket

Usage:

use tokio::sync::mpsc;
use axum::extract::ws::Message;

let (_tx1, rx1) = mpsc::unbounded_channel();
let (tx2, mut rx2) = mpsc::unbounded_channel();

let socket = FakeSocket::<Message, axum::Error>::new(rx1, tx2);
// use it as a websocket in your test
Commit count: 6

cargo fmt