Type Alias caesar_core::shared::Sender

source ·
pub type Sender = Sender<Message>;

Aliased Type§

struct Sender {
    pub(crate) shared: Arc<Shared<Message>>,
}

Fields§

§shared: Arc<Shared<Message>>

Trait Implementations§

source§

impl JsonPacketSender for Sender

Implementation of JsonPacketSender for Sender struct.

This implementation of JsonPacketSender for Sender struct provides a method send_json_packet to send a JsonPacket packet.

source§

fn send_json_packet(&self, packet: JsonPacket)

Sends a JsonPacket packet to a receiver.

This method serializes the JsonPacket using serde_json and sends it as a WebSocketMessage::Text to a receiver.

§Arguments
  • packet - The JsonPacket to send.
source§

impl PacketSender for Sender

Implementation of PacketSender for Sender struct.

This implementation of PacketSender for Sender struct provides methods to send a packet to a receiver.

source§

fn send_packet(&self, destination: u8, value: Value)

Sends a packet to a receiver.

This method serializes the packet and sends it as a WebSocketMessage::Binary to a receiver.

§Arguments
  • destination - The destination of the packet.
  • value - The packet to send.
source§

fn send_encrypted_packet( &self, key: &Option<Aes128Gcm>, destination: u8, value: Value )

Sends an encrypted packet to a receiver.

This method encrypts the packet using the provided key and sends it as a WebSocketMessage::Binary to a receiver.

§Arguments
  • key - The encryption key to use.
  • destination - The destination of the packet.
  • value - The packet to send.