#axum #sockets #test

fake-socket

A simple fake socket for testing purpose

2 unstable releases

0.2.0 Feb 13, 2022
0.1.0 Jan 22, 2022

#2465 in Development tools

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

~2.9–9MB
~78K SLoC