pub enum ReceivedMessage {
ReceivedPacket {
source: PublicKey,
data: Bytes,
},
PeerGone(PublicKey),
Ping([u8; 8]),
Pong([u8; 8]),
KeepAlive,
Health {
problem: Option<String>,
},
ServerRestarting {
reconnect_in: Duration,
try_for: Duration,
},
}
Expand description
The type of message received by the Conn
from a relay server.
Variants§
ReceivedPacket
Represents an incoming packet.
Fields
PeerGone(PublicKey)
Indicates that the client identified by the underlying public key had previously sent you a packet but has now disconnected from the server.
Ping([u8; 8])
Request from a client or server to reply to the
other side with a ReceivedMessage::Pong
with the given payload.
Pong([u8; 8])
Reply to a ReceivedMessage::Ping
from a client or server
with the payload sent previously in the ping.
KeepAlive
A one-way empty message from server to client, just to
keep the connection alive. It’s like a ReceivedMessage::Ping
, but doesn’t solicit
a reply from the client.
Health
A one-way message from server to client, declaring the connection health state.
Fields
problem: Option<String>
If set, is a description of why the connection is unhealthy.
If None
means the connection is healthy again.
The default condition is healthy, so the server doesn’t broadcast a ReceivedMessage::Health
until a problem exists.
ServerRestarting
A one-way message from server to client, advertising that the server is restarting.
Fields
reconnect_in: Duration
An advisory duration that the client should wait before attempting to reconnect. It might be zero. It exists for the server to smear out the reconnects.
try_for: Duration
An advisory duration for how long the client should attempt to reconnect before giving up and proceeding with its normal connection failure logic. The interval between retries is undefined for now. A server should not send a TryFor duration more than a few seconds.
Trait Implementations§
Source§impl Clone for ReceivedMessage
impl Clone for ReceivedMessage
Source§fn clone(&self) -> ReceivedMessage
fn clone(&self) -> ReceivedMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more