1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
use super::{
    actors::actor_key::actor_key::ActorKey,
    user::{user_key::UserKey, User},
};

/// An Event that is emitted as a result of some communication with a Client, or
/// a Tick event
pub enum ServerEvent<T> {
    /// Occurs when a new Client has successfully established a connection with
    /// the Server
    Connection(UserKey),
    /// Occurs when the Server has lost connection to a Client, usually as the
    /// result of a timeout
    Disconnection(UserKey, User),
    /// An Event emitted to the Server from a Client
    Event(UserKey, T),
    /// An Command emitted to the Server from a Client
    Command(UserKey, ActorKey, T),
    /// A Tick Event, the duration between Tick events is defined in the Config
    /// object passed to the Server on initialization
    Tick,
}