Trait bones_framework::external::ggrs::NonBlockingSocket

pub trait NonBlockingSocket<A>: Send + Sync
where A: Clone + PartialEq + Eq + Hash + Send + Sync,
{ // Required methods fn send_to(&mut self, msg: &Message, addr: &A); fn receive_all_messages(&mut self) -> Vec<(A, Message)>; }
Expand description

This NonBlockingSocket trait is used when you want to use GGRS with your own socket. However you wish to send and receive messages, it should be implemented through these two methods. Messages should be sent in an UDP-like fashion, unordered and unreliable. GGRS has an internal protocol on top of this to make sure all important information is sent and received.

Required Methods§

fn send_to(&mut self, msg: &Message, addr: &A)

Takes a Message and sends it to the given address.

fn receive_all_messages(&mut self) -> Vec<(A, Message)>

This method should return all messages received since the last time this method was called. The pairs (A, Message) indicate from which address each packet was received.

Implementors§