// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.Extensions.WebSockets.Internal
{
///
/// Represents well-known WebSocket Close frame status codes.
///
///
/// See https://tools.ietf.org/html/rfc6455#section-7.4 for details
///
public enum WebSocketCloseStatus : ushort
{
///
/// Indicates that the purpose for the connection was fulfilled and thus the connection was closed normally.
///
NormalClosure = 1000,
///
/// Indicates that the other endpoint is going away, such as a server shutting down or a browser navigating to a new page.
///
EndpointUnavailable = 1001,
///
/// Indicates that a protocol error has occurred, causing the connection to be terminated.
///
ProtocolError = 1002,
///
/// Indicates an invalid message type was received. For example, if the end point only supports messages
/// but received a message.
///
InvalidMessageType = 1003,
///
/// Indicates that the Close frame did not have a status code. Not used in actual transmission.
///
Empty = 1005,
///
/// Indicates that the underlying transport connection was terminated without a proper close handshake. Not used in actual transmission.
///
AbnormalClosure = 1006,
///
/// Indicates that an invalid payload was encountered. For example, a frame of type contained non-UTF-8 data.
///
InvalidPayloadData = 1007,
///
/// Indicates that the connection is being terminated due to a violation of policy. This is a generic error code used whenever a party needs to terminate
/// a connection without disclosing the specific reason.
///
PolicyViolation = 1008,
///
/// Indicates that the connection is being terminated due to an endpoint receiving a message that is too large.
///
MessageTooBig = 1009,
///
/// Indicates that the connection is being terminated due to being unable to negotiate a mandatory extension with the other party. Usually sent
/// from the client to the server after the client finishes handshaking without negotiating the extension.
///
MandatoryExtension = 1010,
///
/// Indicates that a server is terminating the connection due to an internal error.
///
InternalServerError = 1011,
///
/// Indicates that the connection failed to establish because the TLS handshake failed. Not used in actual transmission.
///
TLSHandshakeFailed = 1015
}
}