dart-lang / dart-lang/http

Remove code copied from the SDK

Open
#1,552 0 comments 0 reactions 0 assignees View on GitHub
next-breaking-release package:web_socket_channel
Dominant language
Dart
Stars
1.1k
Forks
419
Avg merge
4d 14h
Merged PRs (30d)
8

Description

We currently have over a thousand lines of code to support a single API:

https://github.com/dart-lang/web_socket_channel/blob/c57baea6168b446a27745cf188fb0f54d539de2c/lib/src/channel.dart#L98-L102

That API has very little usage. I think the only Dart team usage may be from `shelf_web_socket`.

As far as I can tell, unless we either give access to the underlying `Socket` from the `package:shelf` APIs it is not possible to implement the `shelf_web_socket` behavior without this copied code from the SDK living somewhere.

We could consider adding a `WebSocket.upgrade(Stream>, StreamSink>)` static method in `dart:io` which I think would give us enough to remove the copied code.

Contributor guide

Open the contributing guide

Research direction

Start with the referenced lib/src/channel.dart lines 98-102 and trace the corresponding usage in shelf_web_socket. Then assess whether dart:io needs a WebSocket.upgrade API accepting the shown stream types before the copied SDK code can be removed. Done means the dependency is available and the duplicated implementation is gone without breaking shelf_web_socket behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.