| 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 final String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; | 5 final String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; |
| 6 | 6 |
| 7 class _WebSocketMessageType { | 7 class _WebSocketMessageType { |
| 8 static final int NONE = 0; | 8 static final int NONE = 0; |
| 9 static final int BINARY = 1; | 9 static final int BINARY = 1; |
| 10 static final int TEXT = 2; | 10 static final int TEXT = 2; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } else { | 496 } else { |
| 497 _outputStream.write(buffer.getRange(offset, count)); | 497 _outputStream.write(buffer.getRange(offset, count)); |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 _onWebSocketMessageEnd() { | 501 _onWebSocketMessageEnd() { |
| 502 if (_onMessage != null) { | 502 if (_onMessage != null) { |
| 503 if (_currentMessageType == _WebSocketMessageType.TEXT) { | 503 if (_currentMessageType == _WebSocketMessageType.TEXT) { |
| 504 _onMessage(_decoder.decoded); | 504 _onMessage(_decoder.decoded); |
| 505 } else { | 505 } else { |
| 506 _onMessage(_outputStream.contents()); | 506 _onMessage(_outputStream.read()); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 _decoder = null; | 509 _decoder = null; |
| 510 _outputStream = null; | 510 _outputStream = null; |
| 511 } | 511 } |
| 512 | 512 |
| 513 _onWebSocketPing(List<int> payload) { | 513 _onWebSocketPing(List<int> payload) { |
| 514 _sendFrame(_WebSocketOpcode.PONG, payload); | 514 _sendFrame(_WebSocketOpcode.PONG, payload); |
| 515 } | 515 } |
| 516 | 516 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 881 |
| 882 class _WebSocketCloseEvent implements CloseEvent { | 882 class _WebSocketCloseEvent implements CloseEvent { |
| 883 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 883 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
| 884 bool get wasClean() => _wasClean; | 884 bool get wasClean() => _wasClean; |
| 885 int get code() => _code; | 885 int get code() => _code; |
| 886 String get reason() => _reason; | 886 String get reason() => _reason; |
| 887 bool _wasClean; | 887 bool _wasClean; |
| 888 int _code; | 888 int _code; |
| 889 String _reason; | 889 String _reason; |
| 890 } | 890 } |
| OLD | NEW |