#pubsub #mpsc #channel #dashmap

simple_pubsub

A simple pubsub use dashmap and mpsc channel

2 releases

0.5.3 Feb 13, 2022
0.5.2 Jan 22, 2022
0.5.1 Jan 22, 2022
0.5.0 Jan 22, 2022

#1773 in Development tools

MIT license

9KB
155 lines

Simple Pubsub

Usage:

let topic = "lobby";
let broadcaster: Arc<Broadcaster<String>> = Arc::new(Broadcaster::default());
let (id, mut receiver) = broadcaster.clone().subscribe(topic);
broadcaster.publish(topic, Arc::new("hello world".into()));
let data = receiver.recv().await.unwrap();
assert!(id > 0);
assert_eq!(data.as_ref(), "hello world");

Dependencies

~3–10MB
~72K SLoC