Add january support.

This commit is contained in:
Paul
2021-05-07 18:00:21 +01:00
parent cf7bb832da
commit 7293abfc53
20 changed files with 280 additions and 208 deletions

View File

@@ -107,9 +107,11 @@ pub enum ClientboundNotification {
}
impl ClientboundNotification {
pub async fn publish(self, topic: String) -> Result<(), String> {
prehandle_hook(&self); // ! TODO: this should be moved to pubsub
hive_pubsub::backend::mongo::publish(get_hive(), &topic, self).await
pub fn publish(self, topic: String) {
async_std::task::spawn(async move {
prehandle_hook(&self); // ! TODO: this should be moved to pubsub
hive_pubsub::backend::mongo::publish(get_hive(), &topic, self).await.ok();
});
}
}

View File

@@ -133,9 +133,7 @@ async fn accept(stream: TcpStream) {
id: id.clone(),
online: true,
}
.publish(id)
.await
.ok();
.publish(id);
}
}
Err(_) => {
@@ -173,9 +171,7 @@ async fn accept(stream: TcpStream) {
id: channel.clone(),
user,
}
.publish(channel)
.await
.ok();
.publish(channel);
} else {
send(ClientboundNotification::Error(
WebSocketError::AlreadyAuthenticated,
@@ -196,9 +192,7 @@ async fn accept(stream: TcpStream) {
id: channel.clone(),
user,
}
.publish(channel)
.await
.ok();
.publish(channel);
} else {
send(ClientboundNotification::Error(
WebSocketError::AlreadyAuthenticated,
@@ -238,9 +232,7 @@ async fn accept(stream: TcpStream) {
id: id.clone(),
online: false,
}
.publish(id)
.await
.ok();
.publish(id);
}
}