use flatland_protocol::{EntityId, Intent, Seq, SessionId, Snapshot, Tick, TickDelta};
#[derive(Debug, Clone)]
pub enum SessionEvent {
Welcome {
session_id: SessionId,
entity_id: EntityId,
snapshot: Snapshot,
},
Tick(TickDelta),
IntentAck {
entity_id: EntityId,
seq: Seq,
tick: Tick,
},
Disconnected,
}
#[async_trait::async_trait]
pub trait PlayConnection: Send {
fn session_id(&self) -> SessionId;
fn entity_id(&self) -> EntityId;
async fn submit_intent(&self, intent: Intent) -> anyhow::Result<()>;
fn try_next_event(&mut self) -> Option<SessionEvent>;
async fn next_event(&mut self) -> Option<SessionEvent>;
fn disconnect(&self);
}