1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
/// A websocket packet
///
/// Note: unlike `Frame` this has data allocated on the heap so has static
/// lifetime
#[derive(Debug, Clone)]
pub enum Packet {
    /// Ping packet (with data)
    Ping(Vec<u8>),
    /// Pong packet (with data)
    Pong(Vec<u8>),
    /// Text (utf-8) messsage
    Text(String),
    /// Binary message
    Binary(Vec<u8>),
    /// Close message
    Close(u16, String),
}