Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Wasm support #111

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
run: dart analyze

- name: Run tests
run: dart test -p "chrome,vm"
run: dart test -p "chrome,vm" --compiler chrome:dart2wasm,chrome:dart2js
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.1.2
- Fixed oversight in move to `package:web` which made the package not work with wasm.

## 2.1.1
- Added `pingInterval` to `StompConfig` to control the ping interval of IO WebSockets. Thanks @AndruhovSasha

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Alternatives are:

#### Running unit tests
```dart
dart run test -p "chrome,vm" test/
dart run test -p "chrome,vm" --compiler chrome:dart2wasm,chrome:dart2js test/
```

#### Generating coverage data
Expand Down
2 changes: 1 addition & 1 deletion lib/src/stomp_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'stomp_frame.dart';
import 'stomp_parser.dart';

import 'connect_api.dart'
if (dart.library.html) 'connect_html.dart'
if (dart.library.js_interop) 'connect_html.dart'
if (dart.library.io) 'connect_io.dart' as platform;

typedef StompUnsubscribe = void Function({
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stomp_dart_client
homepage: https://github.com/blackhorse-one/stomp_dart
version: 2.1.1
version: 2.1.2
description: Dart STOMP client for easy messaging interoperability. Build with flutter in mind, but should work for every dart application.
environment:
sdk: ">=2.12.0 <4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion test/stomp_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:web_socket_channel/web_socket_channel.dart';

import 'package:stomp_dart_client/stomp_dart_client.dart';
import 'package:stomp_dart_client/src/connect_api.dart'
if (dart.library.html) 'package:stomp_dart_client/src/connect_html.dart'
if (dart.library.js_interop) 'package:stomp_dart_client/src/connect_html.dart'
if (dart.library.io) 'package:stomp_dart_client/src/connect_io.dart'
as platform;

Expand Down
6 changes: 4 additions & 2 deletions test/stomp_handler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ void main() {
late StompConfig config;
StompHandler? handler;
late StreamChannel streamChannel;
int? port;

setUpAll(() async {
// Basic STOMP Server
Expand Down Expand Up @@ -69,7 +68,10 @@ void main() {
stayAlive: true,
);

port = await streamChannel.stream.first;
dynamic port = await streamChannel.stream.first;
if (port is double) {
port = port.toInt();
}
config = StompConfig(
url: 'ws://localhost:$port',
);
Expand Down
8 changes: 7 additions & 1 deletion test/stomp_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ void main() {
stayAlive: true,
);

final port = await streamChannel.stream.first;
dynamic port = await streamChannel.stream.first;
if (port is double) {
port = port.toInt();
}
config = StompConfig(
url: 'ws://localhost:$port',
);
Expand Down Expand Up @@ -120,6 +123,9 @@ void main() {
);

dynamic customPort = await customChannel.stream.first;
if (customPort is double) {
customPort = customPort.toInt();
}
late StompClient client;
final onWebSocketDone = expectAsync0(() {}, count: 2);

Expand Down