| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of vmservice_io; | 5 part of vmservice_io; |
| 6 | 6 |
| 7 class WebSocketClient extends Client { | 7 class WebSocketClient extends Client { |
| 8 static const int PARSE_ERROR_CODE = 4000; | 8 static const int PARSE_ERROR_CODE = 4000; |
| 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; | 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; |
| 10 static const int NOT_MAP_ERROR_CODE = 4002; | 10 static const int NOT_MAP_ERROR_CODE = 4002; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 try { | 53 try { |
| 54 if (result is String || result is Uint8List) { | 54 if (result is String || result is Uint8List) { |
| 55 socket.add(result); // String or binary message. | 55 socket.add(result); // String or binary message. |
| 56 } else { | 56 } else { |
| 57 // String message as external Uint8List. | 57 // String message as external Uint8List. |
| 58 assert(result is List); | 58 assert(result is List); |
| 59 Uint8List cstring = result[0]; | 59 Uint8List cstring = result[0]; |
| 60 socket.addUtf8Text(cstring); | 60 socket.addUtf8Text(cstring); |
| 61 } | 61 } |
| 62 } catch (_) { | 62 } catch (e, st) { |
| 63 print("Ignoring error posting over WebSocket."); | 63 print("Ignoring error posting over WebSocket."); |
| 64 print(e); |
| 65 print(st); |
| 64 } | 66 } |
| 65 } | 67 } |
| 66 | 68 |
| 67 dynamic toJson() { | 69 dynamic toJson() { |
| 68 Map map = super.toJson(); | 70 Map map = super.toJson(); |
| 69 map['type'] = 'WebSocketClient'; | 71 map['type'] = 'WebSocketClient'; |
| 70 map['socket'] = '$socket'; | 72 map['socket'] = '$socket'; |
| 71 return map; | 73 return map; |
| 72 } | 74 } |
| 73 } | 75 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 _notifyServerState("", 0); | 320 _notifyServerState("", 0); |
| 319 onServerAddressChange(null); | 321 onServerAddressChange(null); |
| 320 return this; | 322 return this; |
| 321 }); | 323 }); |
| 322 } | 324 } |
| 323 | 325 |
| 324 } | 326 } |
| 325 | 327 |
| 326 void _notifyServerState(String ip, int port) | 328 void _notifyServerState(String ip, int port) |
| 327 native "VMServiceIO_NotifyServerState"; | 329 native "VMServiceIO_NotifyServerState"; |
| OLD | NEW |