CloseStatusCode.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. namespace XGame.Framework.Network.Web
  2. {
  3. /// <summary>
  4. /// Indicates the status code for the WebSocket connection close.
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// The values of this enumeration are defined in
  9. /// <see href="http://tools.ietf.org/html/rfc6455#section-7.4">
  10. /// Section 7.4</see> of RFC 6455.
  11. /// </para>
  12. /// <para>
  13. /// "Reserved value" cannot be sent as a status code in
  14. /// closing handshake by an endpoint.
  15. /// </para>
  16. /// </remarks>
  17. public enum CloseStatusCode : ushort
  18. {
  19. Unknown = 65534,
  20. /// <summary>
  21. /// Equivalent to close status 1000. Indicates normal close.
  22. /// </summary>
  23. Normal = 1000,
  24. /// <summary>
  25. /// Equivalent to close status 1001. Indicates that an endpoint is
  26. /// going away.
  27. /// </summary>
  28. Away = 1001,
  29. /// <summary>
  30. /// Equivalent to close status 1002. Indicates that an endpoint is
  31. /// terminating the connection due to a protocol error.
  32. /// </summary>
  33. ProtocolError = 1002,
  34. /// <summary>
  35. /// Equivalent to close status 1003. Indicates that an endpoint is
  36. /// terminating the connection because it has received a type of
  37. /// data that it cannot accept.
  38. /// </summary>
  39. UnsupportedData = 1003,
  40. /// <summary>
  41. /// Equivalent to close status 1004. Still undefined. A Reserved value.
  42. /// </summary>
  43. Undefined = 1004,
  44. /// <summary>
  45. /// Equivalent to close status 1005. Indicates that no status code was
  46. /// actually present. A Reserved value.
  47. /// </summary>
  48. NoStatus = 1005,
  49. /// <summary>
  50. /// Equivalent to close status 1006. Indicates that the connection was
  51. /// closed abnormally. A Reserved value.
  52. /// </summary>
  53. Abnormal = 1006,
  54. /// <summary>
  55. /// Equivalent to close status 1007. Indicates that an endpoint is
  56. /// terminating the connection because it has received a message that
  57. /// contains data that is not consistent with the type of the message.
  58. /// </summary>
  59. InvalidData = 1007,
  60. /// <summary>
  61. /// Equivalent to close status 1008. Indicates that an endpoint is
  62. /// terminating the connection because it has received a message that
  63. /// violates its policy.
  64. /// </summary>
  65. PolicyViolation = 1008,
  66. /// <summary>
  67. /// Equivalent to close status 1009. Indicates that an endpoint is
  68. /// terminating the connection because it has received a message that
  69. /// is too big to process.
  70. /// </summary>
  71. TooBig = 1009,
  72. /// <summary>
  73. /// Equivalent to close status 1010. Indicates that a client is
  74. /// terminating the connection because it has expected the server to
  75. /// negotiate one or more extension, but the server did not return
  76. /// them in the handshake response.
  77. /// </summary>
  78. MandatoryExtension = 1010,
  79. /// <summary>
  80. /// Equivalent to close status 1011. Indicates that a server is
  81. /// terminating the connection because it has encountered an unexpected
  82. /// condition that prevented it from fulfilling the request.
  83. /// </summary>
  84. ServerError = 1011,
  85. /// <summary>
  86. /// Equivalent to close status 1015. Indicates that the connection was
  87. /// closed due to a failure to perform a TLS handshake. A Reserved value.
  88. /// </summary>
  89. TlsHandshakeFailure = 1015,
  90. }
  91. }