Add event when no more messages, indicating that the server has stopped
This commit is contained in:
parent
bece4b3ac0
commit
34a37d0630
|
@ -27,7 +27,7 @@ use tokio::{
|
|||
use tokio_tungstenite::{tungstenite::Message, MaybeTlsStream, WebSocketStream};
|
||||
|
||||
#[cfg(feature = "events")]
|
||||
use crate::events::Event;
|
||||
use crate::events::{Event, EventType};
|
||||
use crate::{
|
||||
requests::{Request, RequestType},
|
||||
responses::{AuthRequired, Response},
|
||||
|
@ -208,6 +208,16 @@ impl Client {
|
|||
error!("failed handling message: {:?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "events")]
|
||||
{
|
||||
let event = Event {
|
||||
stream_timecode: None,
|
||||
rec_timecode: None,
|
||||
ty: EventType::ServerStopped,
|
||||
};
|
||||
events_tx.send(event).ok();
|
||||
}
|
||||
});
|
||||
|
||||
let write = Mutex::new(write);
|
||||
|
|
|
@ -577,6 +577,8 @@ pub enum EventType {
|
|||
},
|
||||
/// WebSocket server is stopping.
|
||||
ServerStopping,
|
||||
/// WebSocket server has stopped.
|
||||
ServerStopped,
|
||||
/// Fallback value for any unknown event type.
|
||||
#[serde(other)]
|
||||
Unknown,
|
||||
|
|
Loading…
Reference in a new issue