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