Breaking change to service protocol

82 views
Skip to first unread message

John Mccutchan

unread,
Nov 14, 2016, 10:31:18 AM11/14/16
to anno...@dartlang.org

Hi Dart developers,


In Dart 1.22 the URL to the service protocol and Observatory will change.


The message printed by the VM will change:


Current base URL:

Observatory listening on http://127.0.0.1:54804/

New base URL:

Observatory listening on http://127.0.0.1:54804/<token>/

For example:

Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/

Clients of the service protocol will need to be updated to scrape the whole URL instead of just the host + port.


Adapting to the new format is straightforward. Here is a small snippet of Dart code that supports both the old and the new URLs:


const kObservatoryListening = 'Observatory listening on ';

if (line.startsWith(kObservatoryListening)) {

 uri = Uri.parse(line.substring(kObservatoryListening.length));

}


It is strongly recommended that tools scrape the whole base URL so as to be protected against future changes to the base URL.


Opting in to Dart 1.22 behaviour


In Dart 1.21, you can set the DART_SERVICE_USE_AUTH Dart environment variable to “true” to get the new behaviour. For example,


$ dart -DDART_SERVICE_USE_AUTH=true --observe ~/hello_world.dart

Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/


Reply all
Reply to author
Forward
0 new messages