forked from jmug/stoatchat
Ready payload on websocket, add friend by username + avatars.
This commit is contained in:
@@ -2,12 +2,12 @@ use rauth::auth::Session;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use snafu::Snafu;
|
||||
|
||||
use crate::database::entities::RelationshipStatus;
|
||||
use crate::database::entities::{RelationshipStatus, User};
|
||||
|
||||
use super::hive::get_hive;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Snafu)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(tag = "error")]
|
||||
pub enum WebSocketError {
|
||||
#[snafu(display("This error has not been labelled."))]
|
||||
LabelMe,
|
||||
@@ -32,6 +32,9 @@ pub enum ServerboundNotification {
|
||||
pub enum ClientboundNotification {
|
||||
Error(WebSocketError),
|
||||
Authenticated,
|
||||
Ready {
|
||||
user: User
|
||||
},
|
||||
|
||||
/*MessageCreate {
|
||||
id: String,
|
||||
|
||||
@@ -96,6 +96,7 @@ async fn accept(stream: TcpStream) {
|
||||
subscriptions::generate_subscriptions(&user),
|
||||
) {
|
||||
send(ClientboundNotification::Authenticated);
|
||||
send(ClientboundNotification::Ready { user });
|
||||
} else {
|
||||
send(ClientboundNotification::Error(
|
||||
WebSocketError::InternalError,
|
||||
|
||||
Reference in New Issue
Block a user