| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 dynamic toJson() { | 50 dynamic toJson() { |
| 51 Map map = super.toJson(); | 51 Map map = super.toJson(); |
| 52 map['type'] = 'WebSocketClient'; | 52 map['type'] = 'WebSocketClient'; |
| 53 map['socket'] = '$socket'; | 53 map['socket'] = '$socket'; |
| 54 return map; | 54 return map; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 class HttpRequestClient extends Client { | 59 class HttpRequestClient extends Client { |
| 60 static ContentType jsonContentType = ContentType.parse('application/json'); | 60 static ContentType jsonContentType = |
| 61 new ContentType("application", "json", charset: "utf-8"); |
| 61 final HttpRequest request; | 62 final HttpRequest request; |
| 62 | 63 |
| 63 HttpRequestClient(this.request, service) : super(service); | 64 HttpRequestClient(this.request, service) : super(service); |
| 64 | 65 |
| 65 void post(var seq, String response) { | 66 void post(var seq, String response) { |
| 66 request.response..headers.contentType = jsonContentType | 67 request.response..headers.contentType = jsonContentType |
| 67 ..write(response) | 68 ..write(response) |
| 68 ..close(); | 69 ..close(); |
| 69 close(); | 70 close(); |
| 70 } | 71 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 port = s.port; | 125 port = s.port; |
| 125 _server = s; | 126 _server = s; |
| 126 _server.listen(_requestHandler); | 127 _server.listen(_requestHandler); |
| 127 if (display_message) { | 128 if (display_message) { |
| 128 print('VMService listening on port $port'); | 129 print('VMService listening on port $port'); |
| 129 } | 130 } |
| 130 return s; | 131 return s; |
| 131 }); | 132 }); |
| 132 } | 133 } |
| 133 } | 134 } |
| OLD | NEW |