(code)
| 171 | }; |
| 172 | |
| 173 | function validateCloseReason(code) { |
| 174 | if (code < 1000) { |
| 175 | // Status codes in the range 0-999 are not used |
| 176 | return false; |
| 177 | } |
| 178 | if (code >= 1000 && code <= 2999) { |
| 179 | // Codes from 1000 - 2999 are reserved for use by the protocol. Only |
| 180 | // a few codes are defined, all others are currently illegal. |
| 181 | return [1000, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015].indexOf(code) !== -1; |
| 182 | } |
| 183 | if (code >= 3000 && code <= 3999) { |
| 184 | // Reserved for use by libraries, frameworks, and applications. |
| 185 | // Should be registered with IANA. Interpretation of these codes is |
| 186 | // undefined by the WebSocket protocol. |
| 187 | return true; |
| 188 | } |
| 189 | if (code >= 4000 && code <= 4999) { |
| 190 | // Reserved for private use. Interpretation of these codes is |
| 191 | // undefined by the WebSocket protocol. |
| 192 | return true; |
| 193 | } |
| 194 | if (code >= 5000) { |
| 195 | return false; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | util.inherits(WebSocketConnection, EventEmitter); |
| 200 |
no outgoing calls
no test coverage detected