| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 var resource = Resource.resources[path]; | 120 var resource = Resource.resources[path]; |
| 121 if (resource != null) { | 121 if (resource != null) { |
| 122 // Serving up a static resource (e.g. .css, .html, .png). | 122 // Serving up a static resource (e.g. .css, .html, .png). |
| 123 request.response.headers.contentType = | 123 request.response.headers.contentType = |
| 124 ContentType.parse(resource.mimeType); | 124 ContentType.parse(resource.mimeType); |
| 125 request.response.add(resource.data); | 125 request.response.add(resource.data); |
| 126 request.response.close(); | 126 request.response.close(); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 // HTTP based service request. |
| 129 var client = new HttpRequestClient(request, _service); | 130 var client = new HttpRequestClient(request, _service); |
| 130 var message = new Message.fromUri(client, request.uri); | 131 var message = new Message.fromUri(client, request.uri); |
| 131 client.onMessage(null, message); | 132 client.onMessage(null, message); |
| 132 } | 133 } |
| 133 | 134 |
| 134 Future startup() { | 135 Future startup() { |
| 135 if (_server != null) { | 136 if (_server != null) { |
| 136 // Already running. | 137 // Already running. |
| 137 return new Future.value(this); | 138 return new Future.value(this); |
| 138 } | 139 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); | 188 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); |
| 188 _notifyServerState("", 0); | 189 _notifyServerState("", 0); |
| 189 return this; | 190 return this; |
| 190 }); | 191 }); |
| 191 } | 192 } |
| 192 | 193 |
| 193 } | 194 } |
| 194 | 195 |
| 195 void _notifyServerState(String ip, int port) | 196 void _notifyServerState(String ip, int port) |
| 196 native "VMServiceIO_NotifyServerState"; | 197 native "VMServiceIO_NotifyServerState"; |
| OLD | NEW |