CloseEvent.hx 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\CloseEvent.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. A `CloseEvent` is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the `WebSocket` object's `onclose` attribute.
  26. Documentation [CloseEvent](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent>
  28. **/
  29. @:native("CloseEvent")
  30. extern class CloseEvent extends Event {
  31. /**
  32. Returns a `Boolean` that Indicates whether or not the connection was cleanly closed.
  33. **/
  34. var wasClean(default,null) : Bool;
  35. /**
  36. Returns an <code>unsigned short</code> containing the close code send by the server. The following values are permitted status codes. The following definitions are sourced from the IANA website [Ref]. Note that the 1xxx codes are only WebSocket-internal and not for the same meaning by the transported data (like when the application-layer protocol is invalid). The only permitted codes to be specified in Firefox are 1000 and 3000 to 4999 [Source, Bug].
  37. <table id="Status_codes" class="standard-table">
  38. <tr>
  39. <td class="header">Status code</td>
  40. <td class="header">Name</td>
  41. <td class="header">Description</td>
  42. </tr>
  43. <tr>
  44. <td><code>0</code>–<code>999</code></td>
  45. <td> </td>
  46. <td>Reserved and not used.</td>
  47. </tr>
  48. <tr>
  49. <td><code>1000</code></td>
  50. <td>Normal Closure</td>
  51. <td>Normal closure; the connection successfully completed whatever purpose for which it was created.</td>
  52. </tr>
  53. <tr>
  54. <td><code>1001</code></td>
  55. <td>Going Away</td>
  56. <td>The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.</td>
  57. </tr>
  58. <tr>
  59. <td><code>1002</code></td>
  60. <td>Protocol Error</td>
  61. <td>The endpoint is terminating the connection due to a protocol error.</td>
  62. </tr>
  63. <tr>
  64. <td><code>1003</code></td>
  65. <td>Unsupported Data</td>
  66. <td>The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data).</td>
  67. </tr>
  68. <tr>
  69. <td><code>1004</code></td>
  70. <td> </td>
  71. <td>Reserved. A meaning might be defined in the future.</td>
  72. </tr>
  73. <tr>
  74. <td><code>1005</code></td>
  75. <td>No Status Recvd</td>
  76. <td>Reserved.  Indicates that no status code was provided even though one was expected.</td>
  77. </tr>
  78. <tr>
  79. <td><code>1006</code></td>
  80. <td>Abnormal Closure</td>
  81. <td>Reserved. Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.</td>
  82. </tr>
  83. <tr>
  84. <td><code>1007</code></td>
  85. <td>Invalid frame payload data</td>
  86. <td>The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).</td>
  87. </tr>
  88. <tr>
  89. <td><code>1008</code></td>
  90. <td>Policy Violation</td>
  91. <td>The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable.</td>
  92. </tr>
  93. <tr>
  94. <td><code>1009</code></td>
  95. <td>Message too big</td>
  96. <td>The endpoint is terminating the connection because a data frame was received that is too large.</td>
  97. </tr>
  98. <tr>
  99. <td><code>1010</code></td>
  100. <td>Missing Extension</td>
  101. <td>The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't.</td>
  102. </tr>
  103. <tr>
  104. <td><code>1011</code></td>
  105. <td>Internal Error</td>
  106. <td>The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.</td>
  107. </tr>
  108. <tr>
  109. <td><code>1012</code></td>
  110. <td>Service Restart</td>
  111. <td>The server is terminating the connection because it is restarting. [Ref]</td>
  112. </tr>
  113. <tr>
  114. <td><code>1013</code></td>
  115. <td>Try Again Later</td>
  116. <td>The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients. [Ref]</td>
  117. </tr>
  118. <tr>
  119. <td><code>1014</code></td>
  120. <td>Bad Gateway</td>
  121. <td>The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code.</td>
  122. </tr>
  123. <tr>
  124. <td><code>1015</code></td>
  125. <td>TLS Handshake</td>
  126. <td>Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).</td>
  127. </tr>
  128. <tr>
  129. <td><code>1016</code>–<code>1999</code></td>
  130. <td> </td>
  131. <td>Reserved for future use by the WebSocket standard.</td>
  132. </tr>
  133. <tr>
  134. <td><code>2000</code>–<code>2999</code></td>
  135. <td> </td>
  136. <td>Reserved for use by WebSocket extensions.</td>
  137. </tr>
  138. <tr>
  139. <td><code>3000</code>–<code>3999</code></td>
  140. <td> </td>
  141. <td>Available for use by libraries and frameworks. May not be used by applications. Available for registration at the IANA via first-come, first-serve.</td>
  142. </tr>
  143. <tr>
  144. <td><code>4000</code>–<code>4999</code></td>
  145. <td> </td>
  146. <td>Available for use by applications.</td>
  147. </tr>
  148. </table>
  149. **/
  150. var code(default,null) : Int;
  151. /**
  152. Returns a `DOMString` indicating the reason the server closed the connection. This is specific to the particular server and sub-protocol.
  153. **/
  154. var reason(default,null) : String;
  155. /** @throws DOMError */
  156. function new( type : String, ?eventInitDict : CloseEventInit ) : Void;
  157. }