| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 5 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 6 | 6 |
| 7 class _WebSocketMessageType { | 7 class _WebSocketMessageType { |
| 8 static const int NONE = 0; | 8 static const int NONE = 0; |
| 9 static const int BINARY = 1; | 9 static const int BINARY = 1; |
| 10 static const int TEXT = 2; | 10 static const int TEXT = 2; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Hack - as we always do index++ below. | 209 // Hack - as we always do index++ below. |
| 210 index--; | 210 index--; |
| 211 } | 211 } |
| 212 | 212 |
| 213 // Move to the next byte. | 213 // Move to the next byte. |
| 214 index++; | 214 index++; |
| 215 } | 215 } |
| 216 } catch (e) { | 216 } catch (e) { |
| 217 if (onClosed !== null) onClosed(1006, "Protocol error"); | 217 if (onClosed !== null) onClosed(1002, "Protocol error"); |
| 218 _state = FAILURE; | 218 _state = FAILURE; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * Indicate that the underlying communication channel has been closed. | 223 * Indicate that the underlying communication channel has been closed. |
| 224 */ | 224 */ |
| 225 void closed() { | 225 void closed() { |
| 226 if (_state == START || _state == CLOSED || _state == FAILURE) return; | 226 if (_state == START || _state == CLOSED || _state == FAILURE) return; |
| 227 if (onClosed !== null) onClosed(1006, "Connection closed unexpectedly"); | 227 if (onClosed !== null) onClosed(1006, "Connection closed unexpectedly"); |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 | 846 |
| 847 class _WebSocketCloseEvent implements CloseEvent { | 847 class _WebSocketCloseEvent implements CloseEvent { |
| 848 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 848 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
| 849 bool get wasClean => _wasClean; | 849 bool get wasClean => _wasClean; |
| 850 int get code => _code; | 850 int get code => _code; |
| 851 String get reason => _reason; | 851 String get reason => _reason; |
| 852 bool _wasClean; | 852 bool _wasClean; |
| 853 int _code; | 853 int _code; |
| 854 String _reason; | 854 String _reason; |
| 855 } | 855 } |
| OLD | NEW |