Skip to main content

ServerEvent

Enum ServerEvent 

Source
pub enum ServerEvent {
Show 23 variants NewMessage { data: NewMessageData, }, SyncMessageHistory { data: SyncMessageHistoryData, }, MessageStatusUpdated { data: MessageStatusUpdatedData, }, MessageDeleted { data: MessageDeletedData, }, SyncConversationList { data: SyncConversationListData, }, ConversationUpdated { data: Conversation, }, ConversationMembersUpdated { data: ConversationMembersUpdatedData, }, AddedToConversation { data: Conversation, }, RemovedFromConversation { data: RemovedFromConversationData, }, SyncFriendList { data: SyncFriendListData, }, FriendshipUpdated { data: Friendship, }, FriendDeleted { data: FriendDeletedData, }, FriendRequestReceived { data: FriendRequest, }, FriendRequestResponded { data: FriendRequest, }, SyncFriendRequests { data: SyncFriendRequestsData, }, UserPresenceUpdated { data: UserPresenceData, }, UserInfoUpdated { data: User, }, AddedToBlacklist { data: BlacklistEventData, }, RemovedFromBlacklist { data: BlacklistEventData, }, Notification { data: NotificationData, }, SystemMessage { data: SystemMessageData, }, SyncCompleted { data: SyncCompletedData, }, DataUpdated { data: DataUpdatedData, },
}
Expand description

服务端 MQTT 事件

这些事件通过 MQTT 主题推送,使用 event_type 字段进行区分

Variants§

§

NewMessage

新消息

Fields

§

SyncMessageHistory

消息历史同步

§

MessageStatusUpdated

消息状态更新

§

MessageDeleted

消息被删除

§

SyncConversationList

会话列表同步

§

ConversationUpdated

会话更新

Fields

§

ConversationMembersUpdated

会话成员更新

§

AddedToConversation

用户被添加到会话

Fields

§

RemovedFromConversation

用户被从会话移除

§

SyncFriendList

好友列表同步

§

FriendshipUpdated

好友关系更新

Fields

§

FriendDeleted

好友被删除

§

FriendRequestReceived

收到好友请求

Fields

§

FriendRequestResponded

好友请求被响应

Fields

§

SyncFriendRequests

好友请求列表同步

§

UserPresenceUpdated

用户在线状态更新

Fields

§

UserInfoUpdated

用户信息更新

Fields

§data: User
§

AddedToBlacklist

被添加到黑名单

§

RemovedFromBlacklist

被从黑名单移除

§

Notification

通知

Fields

§

SystemMessage

系统消息

§

SyncCompleted

同步完成

§

DataUpdated

通用数据更新

Fields

Implementations§

Source§

impl ServerEvent

Source

pub fn event_type(&self) -> &'static str

获取事件类型字符串

Source

pub fn is_sync_event(&self) -> bool

判断是否为数据同步事件

Source

pub fn conversation_id(&self) -> Option<String>

获取关联的会话 ID(如果有)

Source

pub fn user_id(&self) -> Option<String>

获取关联的用户 ID(如果有)

Trait Implementations§

Source§

impl Clone for ServerEvent

Source§

fn clone(&self) -> ServerEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ServerEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ServerEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,