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.