WebSocketStatusCodes.cs 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #if !BESTHTTP_DISABLE_WEBSOCKET
  2. namespace BestHTTP.WebSocket
  3. {
  4. /// <summary>
  5. /// http://tools.ietf.org/html/rfc6455#section-7.4.1
  6. /// </summary>
  7. public enum WebSocketStausCodes : ushort
  8. {
  9. /// <summary>
  10. /// Indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
  11. /// </summary>
  12. NormalClosure = 1000,
  13. /// <summary>
  14. /// Indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
  15. /// </summary>
  16. GoingAway = 1001,
  17. /// <summary>
  18. /// Indicates that an endpoint is terminating the connection due to a protocol error.
  19. /// </summary>
  20. ProtocolError = 1002,
  21. /// <summary>
  22. /// Indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept
  23. /// (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
  24. /// </summary>
  25. WrongDataType = 1003,
  26. /// <summary>
  27. /// Reserved. The specific meaning might be defined in the future.
  28. /// </summary>
  29. Reserved = 1004,
  30. /// <summary>
  31. /// A reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint.
  32. /// It is designated for use in applications expecting a status code to indicate that no status code was actually present.
  33. /// </summary>
  34. NoStatusCode = 1005,
  35. /// <summary>
  36. /// A reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint.
  37. /// It is designated for use in applications expecting a status code to indicate that the connection was closed abnormally, e.g., without sending or receiving a Close control frame.
  38. /// </summary>
  39. ClosedAbnormally = 1006,
  40. /// <summary>
  41. /// Indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message).
  42. /// </summary>
  43. DataError = 1007,
  44. /// <summary>
  45. /// Indicates that an endpoint is terminating the connection because it has received a message that violates its policy.
  46. /// This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
  47. /// </summary>
  48. PolicyError = 1008,
  49. /// <summary>
  50. /// Indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
  51. /// </summary>
  52. TooBigMessage = 1009,
  53. /// <summary>
  54. /// Indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension,
  55. /// but the server didn't return them in the response message of the WebSocket handshake.
  56. /// The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead.
  57. /// </summary>
  58. ExtensionExpected = 1010,
  59. /// <summary>
  60. /// Indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
  61. /// </summary>
  62. WrongRequest = 1011,
  63. /// <summary>
  64. /// A reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).
  65. /// </summary>
  66. TLSHandshakeError = 1015
  67. }
  68. }
  69. #endif