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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 Function onMessageStart; | 351 Function onMessageStart; |
352 Function onMessageData; | 352 Function onMessageData; |
353 Function onMessageEnd; | 353 Function onMessageEnd; |
354 Function onPing; | 354 Function onPing; |
355 Function onPong; | 355 Function onPong; |
356 Function onClosed; | 356 Function onClosed; |
357 } | 357 } |
358 | 358 |
359 | 359 |
360 class _WebSocketConnectionBase { | 360 class _WebSocketConnectionBase { |
361 void _socketConnected(Socket socket) { | 361 void _socketConnected(Socket socket) { |
362 _socket = socket; | 362 _socket = socket; |
363 _socket.onError = (e) => _socket.close(); | 363 _socket.onError = (e) => _socket.close(); |
364 } | 364 } |
365 | 365 |
366 void _startProcessing(List<int> unparsedData) { | 366 void _startProcessing(List<int> unparsedData) { |
367 _WebSocketProtocolProcessor processor = new _WebSocketProtocolProcessor(); | 367 _WebSocketProtocolProcessor processor = new _WebSocketProtocolProcessor(); |
368 processor.onMessageStart = _onWebSocketMessageStart; | 368 processor.onMessageStart = _onWebSocketMessageStart; |
369 processor.onMessageData = _onWebSocketMessageData; | 369 processor.onMessageData = _onWebSocketMessageData; |
370 processor.onMessageEnd = _onWebSocketMessageEnd; | 370 processor.onMessageEnd = _onWebSocketMessageEnd; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 864 |
865 class _WebSocketCloseEvent implements CloseEvent { | 865 class _WebSocketCloseEvent implements CloseEvent { |
866 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); | 866 _WebSocketCloseEvent(this._wasClean, this._code, this._reason); |
867 bool get wasClean => _wasClean; | 867 bool get wasClean => _wasClean; |
868 int get code => _code; | 868 int get code => _code; |
869 String get reason => _reason; | 869 String get reason => _reason; |
870 bool _wasClean; | 870 bool _wasClean; |
871 int _code; | 871 int _code; |
872 String _reason; | 872 String _reason; |
873 } | 873 } |
OLD | NEW |