[−][src]Crate hive_pubsub
Example
use hive_pubsub::Hive; let mut hive = Hive::new( |users, data| { println!("Received data! [{:?}]: {}.", users, data); } ); hive.subscribe_multiple(1, vec! [ 2, 5 ]).unwrap(); hive.subscribe_multiple(3, vec! [ 2, 6 ]).unwrap(); hive.subscribe_multiple(4, vec! [ 2, 5 ]).unwrap(); hive.drop_topic(&6).unwrap(); hive.publish(&6, "This will not appear.".to_string()).unwrap(); hive.publish(&2, "This will appear for all three clients.".to_string()).unwrap(); hive.drop_client(&3).unwrap(); hive.publish(&2, "This will appear for two of the clients.".to_string()).unwrap(); hive.publish(&5, "This will also appear for two of the clients.".to_string()).unwrap();
Design
Hive is designed to be slotted into any server application to act as a middle-man between you and your clients, it will automatically distribute any notifications you give it to all relevant connected clients and other nodes.
To-do
- Add a model for backend commuication.
- Add MongoDB support (gate behind feature).
Structs
Hive | The pubsub client. |