Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 1606 additions and 108 deletions
This diff is collapsed.
This diff is collapsed.
use super::{events::ClientboundNotification, websocket};
use crate::database::get_collection;
use crate::database::*;
use futures::FutureExt;
use hive_pubsub::backend::mongo::MongodbPubSub;
......@@ -13,7 +13,12 @@ static HIVE: OnceCell<Hive> = OnceCell::new();
pub async fn init_hive() {
let hive = MongodbPubSub::new(
|ids, notification| {
|ids, notification: ClientboundNotification| {
let notif = notification.clone();
async_std::task::spawn(async move {
super::events::posthandle_hook(&notif).await;
});
if let Ok(data) = to_string(&notification) {
debug!("Pushing out notification. {}", data);
websocket::publish(ids, notification);
......@@ -36,8 +41,6 @@ pub async fn listen() {
.fuse()
.await
.expect("Hive hit an error");
dbg!("a");
}
pub fn subscribe_multiple(user: String, topics: Vec<String>) -> Result<(), String> {
......
pub mod events;
pub mod hive;
pub mod websocket;
pub mod payload;
pub mod subscriptions;
pub mod websocket;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.