| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (request.method != 'GET') { | 123 if (request.method != 'GET') { |
| 124 // Not a GET request. Do nothing. | 124 // Not a GET request. Do nothing. |
| 125 request.response.close(); | 125 request.response.close(); |
| 126 return; | 126 return; |
| 127 } | 127 } |
| 128 | 128 |
| 129 final String path = | 129 final String path = |
| 130 request.uri.path == '/' ? ROOT_REDIRECT_PATH : request.uri.path; | 130 request.uri.path == '/' ? ROOT_REDIRECT_PATH : request.uri.path; |
| 131 | 131 |
| 132 if (path == WEBSOCKET_PATH) { | 132 if (path == WEBSOCKET_PATH) { |
| 133 WebSocketTransformer.upgrade(request).then((WebSocket webSocket) { | 133 WebSocketTransformer.upgrade(request, |
| 134 compression: CompressionOptions.OFF).then( |
| 135 (WebSocket webSocket) { |
| 134 new WebSocketClient(webSocket, _service); | 136 new WebSocketClient(webSocket, _service); |
| 135 }); | 137 }); |
| 136 return; | 138 return; |
| 137 } | 139 } |
| 138 | 140 |
| 139 Asset asset = assets[path]; | 141 Asset asset = assets[path]; |
| 140 if (asset != null) { | 142 if (asset != null) { |
| 141 // Serving up a static asset (e.g. .css, .html, .png). | 143 // Serving up a static asset (e.g. .css, .html, .png). |
| 142 request.response.headers.contentType = | 144 request.response.headers.contentType = |
| 143 ContentType.parse(asset.mimeType); | 145 ContentType.parse(asset.mimeType); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); | 216 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); |
| 215 _notifyServerState("", 0); | 217 _notifyServerState("", 0); |
| 216 return this; | 218 return this; |
| 217 }); | 219 }); |
| 218 } | 220 } |
| 219 | 221 |
| 220 } | 222 } |
| 221 | 223 |
| 222 void _notifyServerState(String ip, int port) | 224 void _notifyServerState(String ip, int port) |
| 223 native "VMServiceIO_NotifyServerState"; | 225 native "VMServiceIO_NotifyServerState"; |
| OLD | NEW |