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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 // Hack - as we always do index++ below. | 213 // Hack - as we always do index++ below. |
214 index--; | 214 index--; |
215 } | 215 } |
216 | 216 |
217 // Move to the next byte. | 217 // Move to the next byte. |
218 index++; | 218 index++; |
219 } | 219 } |
220 } catch (var e) { | 220 } catch (e) { |
221 _reportError(e); | 221 _reportError(e); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 /** | 225 /** |
226 * Indicate that the underlying communication channel has been closed. | 226 * Indicate that the underlying communication channel has been closed. |
227 */ | 227 */ |
228 void closed() { | 228 void closed() { |
229 if (_state == START || _state == CLOSED || _state == FAILURE) return; | 229 if (_state == START || _state == CLOSED || _state == FAILURE) return; |
230 _reportError(new WebSocketException("Protocol error $_state")); | 230 _reportError(new WebSocketException("Protocol error $_state")); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 | 882 |
883 class _WebSocketCloseEvent implements CloseEvent { | 883 class _WebSocketCloseEvent implements CloseEvent { |
884 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 884 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
885 bool get wasClean => _wasClean; | 885 bool get wasClean => _wasClean; |
886 int get code => _code; | 886 int get code => _code; |
887 String get reason => _reason; | 887 String get reason => _reason; |
888 bool _wasClean; | 888 bool _wasClean; |
889 int _code; | 889 int _code; |
890 String _reason; | 890 String _reason; |
891 } | 891 } |
OLD | NEW |