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

adjust the HtmlWebSocketChannel ctor parameter type; rev to 2.4.3 #320

Closed devoncarew closed 10 months ago

devoncarew commented 10 months ago

In future major versions of this package, we'd likely re-introduce a type annotation for HtmlWebSocketChannel constructor.


Contribution guidelines:
- See our [contributor guide](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Most changes should add an entry to the changelog and may need to [rev the pubspec package version](https://github.com/dart-lang/sdk/wiki/External-Package-Maintenance#making-a-change). - Changes to packages require [corresponding tests](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md#Testing). Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
github-actions[bot] commented 10 months ago

Package publishing

Package Version Status Publish tag (post-merge)
package:web_socket_channel 2.4.3 ready to publish v2.4.3

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

devoncarew commented 10 months ago

cc @kevmoo, @srujzs, @natebosch for review

I believe the type change from 2.4.1 may only have been observable from the HtmlWebSocketChannel constructor (the single websocket parameter) and the HtmlWebSocketChannel.innerWebSocket field (a WebSocket). I suspect the field (not changed in this PR) is not generally used by clients of this library.

@srujzs - am I correct that the new interop will be ok with the cast at runtime to a package:web WebSocket? The instance could have been from either a package:web WebSocket or a dart:html one.

(see https://github.com/dart-lang/web_socket_channel/pull/319 for a major version rev of this package)

srujzs commented 10 months ago

am I correct that the new interop will be ok with the cast at runtime to a package:web WebSocket? The instance could have been from either a package:web WebSocket or a dart:html one.

Yep. Since we cast to a package:web WebSocket, a cast of a dart:html WebSocket should be trivially true. We do the same "Object and then cast later" business in Flutter as well to support the same use case.