add ping/pong between client and server
the purpose of this is to hopefully prevent nginx from reaping the connection, since there's data flowing through it every so often
This commit is contained in:
parent
b3911b7af1
commit
bf4d538651
3 changed files with 36 additions and 0 deletions
|
@ -300,6 +300,10 @@ impl SessionLoop {
|
|||
|
||||
async fn process_request(&mut self, ws: &mut WebSocket, request: Request) -> eyre::Result<()> {
|
||||
match request {
|
||||
Request::Ping => {
|
||||
ws.send(to_message(&Notify::Pong)).await?;
|
||||
}
|
||||
|
||||
Request::Wall { wall_event } => {
|
||||
match &wall_event {
|
||||
// This match only concerns itself with drawing-related events to offload
|
||||
|
|
|
@ -69,6 +69,8 @@ pub enum LoginResponse {
|
|||
rename_all_fields = "camelCase"
|
||||
)]
|
||||
pub enum Request {
|
||||
Ping,
|
||||
|
||||
Wall {
|
||||
wall_event: wall::EventKind,
|
||||
},
|
||||
|
@ -95,6 +97,8 @@ pub struct ChunkInfo {
|
|||
rename_all_fields = "camelCase"
|
||||
)]
|
||||
pub enum Notify {
|
||||
Pong,
|
||||
|
||||
Wall {
|
||||
wall_event: wall::Event,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue