From 037dea1f8e12a19d81fe43d7cc3749a54315eece Mon Sep 17 00:00:00 2001 From: Alexey Galakhov Date: Fri, 17 Mar 2017 16:01:28 +0100 Subject: [PATCH] Add possibility to send pings Signed-off-by: Alexey Galakhov --- src/protocol/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index cf0f96d..ab811a9 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -109,6 +109,12 @@ impl WebSocket { self.write_pending() } + /// Send ping. + pub fn send_ping(&mut self, payload: Vec) -> Result<()> { + self.send_queue.push_back(Frame::ping(payload)); + self.write_pending() + } + /// Close the connection. /// /// This function guarantees that the close frame will be queued.