| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // The following code is copied from sdk/lib/io/websocket.dart. The "dart:io" | 5 // The following code is copied from sdk/lib/io/websocket.dart. The "dart:io" |
| 6 // implementation isn't used directly to support non-"dart:io" applications. | 6 // implementation isn't used directly to support non-"dart:io" applications. |
| 7 // | 7 // |
| 8 // Because it's copied directly, only modifications necessary to support the | 8 // Because it's copied directly, only modifications necessary to support the |
| 9 // desired public API and to remove "dart:io" dependencies have been made. | 9 // desired public API and to remove "dart:io" dependencies have been made. |
| 10 // | 10 // |
| 11 // This is up-to-date as of sdk revision | 11 // This is up-to-date as of sdk revision |
| 12 // 86227840d75d974feb238f8b3c59c038b99c05cf. | 12 // e41fb4cafd6052157dbc1490d437045240f4773f. |
| 13 |
| 13 /** | 14 /** |
| 14 * Web socket status codes used when closing a web socket connection. | 15 * Web socket status codes used when closing a web socket connection. |
| 15 */ | 16 */ |
| 16 abstract class WebSocketStatus { | 17 abstract class WebSocketStatus { |
| 17 static const int NORMAL_CLOSURE = 1000; | 18 static const int NORMAL_CLOSURE = 1000; |
| 18 static const int GOING_AWAY = 1001; | 19 static const int GOING_AWAY = 1001; |
| 19 static const int PROTOCOL_ERROR = 1002; | 20 static const int PROTOCOL_ERROR = 1002; |
| 20 static const int UNSUPPORTED_DATA = 1003; | 21 static const int UNSUPPORTED_DATA = 1003; |
| 21 static const int RESERVED_1004 = 1004; | 22 static const int RESERVED_1004 = 1004; |
| 22 static const int NO_STATUS_RECEIVED = 1005; | 23 static const int NO_STATUS_RECEIVED = 1005; |
| 23 static const int ABNORMAL_CLOSURE = 1006; | 24 static const int ABNORMAL_CLOSURE = 1006; |
| 24 static const int INVALID_FRAME_PAYLOAD_DATA = 1007; | 25 static const int INVALID_FRAME_PAYLOAD_DATA = 1007; |
| 25 static const int POLICY_VIOLATION = 1008; | 26 static const int POLICY_VIOLATION = 1008; |
| 26 static const int MESSAGE_TOO_BIG = 1009; | 27 static const int MESSAGE_TOO_BIG = 1009; |
| 27 static const int MISSING_MANDATORY_EXTENSION = 1010; | 28 static const int MISSING_MANDATORY_EXTENSION = 1010; |
| 28 static const int INTERNAL_SERVER_ERROR = 1011; | 29 static const int INTERNAL_SERVER_ERROR = 1011; |
| 29 static const int RESERVED_1015 = 1015; | 30 static const int RESERVED_1015 = 1015; |
| 30 } | 31 } |
| 31 | 32 |
| 32 abstract class WebSocket { | 33 abstract class WebSocket { |
| 33 /** | 34 /** |
| 34 * Possible states of the connection. | 35 * Possible states of the connection. |
| 35 */ | 36 */ |
| 36 static const int CONNECTING = 0; | 37 static const int CONNECTING = 0; |
| 37 static const int OPEN = 1; | 38 static const int OPEN = 1; |
| 38 static const int CLOSING = 2; | 39 static const int CLOSING = 2; |
| 39 static const int CLOSED = 3; | 40 static const int CLOSED = 3; |
| 40 } | 41 } |
| OLD | NEW |