Clarify that servers shouldn't implement Websocket ping/pong (#617)

This commit is contained in:
Kai Jewson 2021-12-12 14:08:00 +00:00 committed by GitHub
parent b1623ce7f2
commit b7cc3d4645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -466,11 +466,18 @@ pub enum Message {
Binary(Vec<u8>),
/// A ping message with the specified payload
///
/// The payload here must have a length less than 125 bytes
/// The payload here must have a length less than 125 bytes.
///
/// Ping messages will be automatically responded to by the server, so you do not have to worry
/// about dealing with them yourself.
Ping(Vec<u8>),
/// A pong message with the specified payload
///
/// The payload here must have a length less than 125 bytes
/// The payload here must have a length less than 125 bytes.
///
/// Pong messages will be automatically sent to the client if a ping message is received, so
/// you do not have to worry about constructing them yourself unless you want to implement a
/// [unidirectional heartbeat](https://tools.ietf.org/html/rfc6455#section-5.5.3).
Pong(Vec<u8>),
/// A close message with the optional close frame.
Close(Option<CloseFrame<'static>>),