dart-lang / web_socket_channel

StreamChannel wrappers for WebSockets.
https://pub.dev/packages/web_socket_channel
BSD 3-Clause "New" or "Revised" License
425 stars 112 forks source link

2.4.1 seems to have introduced breaking changes #307

Closed KammererTob closed 10 months ago

KammererTob commented 11 months ago

I've noticed that my package which depends on web_socket_channel suddenly has a "Analysis Issue" in pub.dev (https://pub.dev/packages/stomp_dart_client/score). This seems to be because of a breaking change introduced in 2.4.1. The change in question seems to be a move to the web package for the HTML WebSocket implementation. Here is part of my code which is breaking because of that:

  final completer = Completer<HtmlWebSocketChannel>();
  final webSocket = WebSocket(config.connectUrl)
    ..binaryType = BinaryType.list.value;
  webSocket.onOpen.first.then((value) {
    completer.complete(HtmlWebSocketChannel(webSocket));
  });

Previously HtmlWebSocketChannel was expecting a WebSocket from the dart:html library. After 2.4.1 it seems to be expecting it from the package:web package.

Was this intentional? I am a bit hesitant to also move my project to the web package since it currently is still flagged as "highly experimental" (https://github.com/dart-lang/web)

Related closed issue in the pub.dev repo: https://github.com/dart-lang/pub-dev/issues/7327

devoncarew commented 10 months ago

Do you mind posting the analysis issue you see?

KammererTob commented 10 months ago

I have fixed the dependency in the current version, so the analysis issue is no longer visible on the page. But here is a screenshot: image

devoncarew commented 10 months ago

Thanks for the report! It looks like the port to package:web was unintentionally a breaking API change. This should have been done in a new major version of this package (3.0.0). We'll need to do some cleanup here, which may involve reverting the 2.x version of this package to continue to use dart:html, and re-publishing the package:web based version as 3.0.0.

devoncarew commented 10 months ago

I'm going to close this as the issue has mostly been addressed. If people find new breaking changes please re-open or create a new issue.

KammererTob commented 10 months ago

Thanks for addressing this so quickly!