-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from eclipse-thingweb/fix-tdd-discovery
Make directory discovery a bit more robust
- Loading branch information
Showing
5 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2024 Contributors to the Eclipse Foundation. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
// ignore_for_file: avoid_print | ||
|
||
import "package:dart_wot/binding_http.dart"; | ||
import "package:dart_wot/core.dart"; | ||
|
||
Future<void> main() async { | ||
final servient = Servient.create( | ||
clientFactories: [ | ||
HttpClientFactory(), | ||
], | ||
); | ||
final wot = await servient.start(); | ||
|
||
final url = Uri.parse("http://plugfest.thingweb.io:8081"); | ||
print("Requesting TD from $url ..."); | ||
final thingDiscoveryProcess = await wot.exploreDirectory(url); | ||
|
||
thingDiscoveryProcess.listen( | ||
(thingDescription) => print(thingDescription.title), | ||
onError: print, | ||
); | ||
|
||
await servient.shutdown(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters