opentalk_roomserver_types_ping/
command.rs1use std::time::Duration;
5
6use opentalk_roomserver_signaling::signaling_module::CreateReplica;
7use serde::{Deserialize, Serialize};
8
9use crate::event::{PingEvent, Replication};
10
11#[derive(Deserialize, Serialize, Debug)]
12#[serde(tag = "action", rename_all = "snake_case")]
13pub enum PingCommand {
14 Ping,
16 AsyncDelayedPing {
18 #[serde(with = "opentalk_types_common::utils::duration_seconds")]
20 delay: Duration,
21 },
22 Die,
25 ReplicatedPing,
27}
28
29impl CreateReplica<PingEvent> for PingCommand {
30 fn replicate(&self) -> Option<PingEvent> {
31 match self {
32 PingCommand::ReplicatedPing => {
33 Some(PingEvent::Replication(Replication::ReplicatedPing))
34 }
35 _ => None,
36 }
37 }
38}