#sockets #axum #testing

fake-socket

A simple fake socket for testing purpose

2 unstable releases

0.2.0 Feb 13, 2022
0.1.0 Jan 22, 2022

#2180 in Development tools

40 downloads per month

MIT license

7KB
115 lines

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

Dependencies

~3–4.5MB
~79K SLoC