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 ended abnormally.
25    ///
26    /// Unlike [`ClientDisconnect`], this event reflects any termination other
27    /// than a clean quit or idle timeout: a network failure, a protocol
28    /// violation, or a server-side error while handling a request.
29    ClientConnectionLoss { client_id: String, conn_id: usize },
30
31    /// The system has processed a bloop.
32    BloopProcessed(ProcessedBloop),
33
34    /// One or more achievements were awarded to players.
35    AchievementsAwarded(AchievementAwardBatch),
36}