Files
sdk/pkg/dds/test/web/sse_smoke_driver.dart
T
Ben Konyi 96cf91bea3 [ package:dds ] Update DDS dependencies and set SDK requirement to >=2.12
Also updated non-migrated libraries to include @dart=2.10.

Change-Id: Idcf4e54f9aa37b9b016133144af594cc932418a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192122
Reviewed-by: Gary Roumanis <grouma@google.com>
2021-03-19 19:49:08 +00:00

37 lines
1.1 KiB
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart=2.10
// This file must be compiled for changes to be picked up.
//
// Run the following command from the root of this package if this file is
// updated:
//
// dart2js -o test/web/sse_smoke_driver.dart.js test/web/sse_smoke_driver.dart
import 'dart:convert';
import 'package:async/async.dart';
import 'package:sse/client/sse_client.dart';
import 'package:vm_service/vm_service.dart';
Future<void> main() async {
// Connect to test server
final channel = SseClient('/test');
final testerStream = StreamQueue<String>(channel.stream);
// Connect to DDS
final ddsUri = await testerStream.next;
final ddsChannel = SseClient(ddsUri);
final vmService = VmService(
ddsChannel.stream,
(e) => ddsChannel.sink.add(e),
);
final version = await vmService.getVersion();
channel.sink.add(json.encode(version.json));
ddsChannel.close();
}