@asyncapi/template-dart-websocket-client
v0.0.1
Published
This is a template generating Dart websocket client
Readme
Dart WebSocket Client
You can test this template:
- Clone the project and run
npm install - Navigate to
packages/templates/clients/websocket/dart - Install with
npm installand run test withnpm run test - Navigate to the generated Hoppscotch client folder with
cd test/temp/snapshotTestResult/custom_client_hoppscotch - Install dependencies of the generated client:
dart pub get - Start an example script that uses a client library generated by the test:
dart run --packages=.dart_tool/package_config.json ../../../../example.dart
By default, this is testing against Hoppscotch Echo service. You can modify
packages/templates/clients/websocket/dart/example.dartand change first line toimport 'test/temp/snapshotTestResult/client_postman/client.dart';and line 15final wsClient = PostmanEchoWebSocketClientClient();and rundart run --packages=.dart_tool/package_config.json ../../../../example.dartagain. You will see the example still works but against a different API. This is possible as both AsyncAPI documents have the same name of operation for sending messages:sendEchoMessageso each client generated has the same API.
