Skip to main content

bloop_server_framework/
event.rs

1use crate::achievement::AchievementAwardBatch;
2use crate::bloop::ProcessedBloop;
3use std::net::IpAddr;
4
5/// Represents a significant event within the system.
6///
7/// Events capture changes in client connections or system actions such as
8/// processing bloops or awarding achievements. They can be used for logging,
9/// auditing, or triggering additional behavior.
10#[derive(Debug, Clone)]
11pub enum Event {
12    /// A client successfully connected to the system.
13    ClientConnect {
14        client_id: String,
15        conn_id: usize,
16        local_ip: IpAddr,
17    },
18
19    /// A client has disconnected normally.
20    ///
21    /// Emitted when the client intentionally disconnects from the system.
22    ClientDisconnect { client_id: String, conn_id: usize },
23
24    /// The connection to a client was unexpectedly lost.
25    ///
26    /// Unlike [`ClientDisconnect`], this event reflects an abrupt loss of
27    /// connection, such as a network failure or crash.
28    ClientConnectionLoss { client_id: String, conn_id: usize },
29
30    /// The system has processed a bloop.
31    BloopProcessed(ProcessedBloop),
32
33    /// One or more achievements were awarded to players.
34    AchievementsAwarded(AchievementAwardBatch),
35}