pub enum CloseCode {
    Normal,
    Away,
    ProtocolError,
    Unsupported,
    NoStatusRcvd,
    Abnormal,
    InvalidPayload,
    PolicyViolation,
    MessageTooBig,
    MandatoryExt,
    InternalError,
    TLSHandshake,
    // some variants omitted
}
Expand description

When closing an established connection an endpoint MAY indicate a reason for closure.

Variants

Normal

The purpose for which the connection was established has been fulfilled

Away

Server going down or a browser having navigated away from a page

ProtocolError

An endpoint is terminating the connection due to a protocol error.

Unsupported

It has received a type of data it cannot accept

NoStatusRcvd

MUST NOT be set as a status code in a Close control frame by an endpoint.

No status code was actually present.

Abnormal

MUST NOT be set as a status code in a Close control frame by an endpoint.

Connection was closed abnormally.

InvalidPayload

Application has received data within a message that was not consistent with the type of the message.

PolicyViolation

This is a generic status code that can be returned when there is no other more suitable status code.

MessageTooBig

Message that is too big for it to process.

MandatoryExt

It has expected the server to negotiate one or more extension.

InternalError

The server has encountered an unexpected condition that prevented it from fulfilling the request.

TLSHandshake

MUST NOT be set as a status code in a Close control frame by an endpoint.

The connection was closed due to a failure to perform a TLS handshake.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.