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
Unify dart:html/dart:io WebSocket interfaces. #13513
Comments
In the short term the WebSocket interface in dart:io and dart:html will focus on providing access to all features that each underlying platform supports. Based on these two APIs a common interface can be implemented a a separate package. Added this to the Later milestone. |
This comment was originally written by igor.ko...@mailvision.com Can it be used as such interface ? import 'dart:async'; abstract class AbstractWebSocket { |
This comment was originally written by igor.ko...@mailvision.com Problem here is stream events ! For example html web socket version defined in dartium.dart: @DomName('WebSocket.onerror') @DomName('WebSocket.onmessage') Event, CloseEvent, MessageEvent defined in the same file, so cannot be used in |
This comment was originally written by igor.ko...@mailvision.com I really needed such common interface, so implemented it for dart:io and dart:html abstract class AbstractWebSocket { int get readyState; void close([int code, String reason]); Future<Stream<dynamic>> connect(String url); The test: passed for
Test projects in attachment. Attachments: |
This comment was originally written by igor.ko...@mailvision.com
connect(String url, [dymamic subProtocols]) where subProtocols is String or List<String>
|
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
This comment was originally written by @stevenroose A unified HTTP interface would be very beneficial as well. I'd propose a (fictional) dart:http.HttpClient interface that both dart:io.HttpClient and package:browser_client.BrowserClient can implement. It's very cumbersome that libraries that try to implement a protocol that is specified around HTTP has to worry about whether it is run in VM or a browser. |
Why was this closed? |
This issue was originally filed by george.moschoviti...@gmail.com
The WbeSocket interface in dart:html is different than the one defined in dart:io.
So when you have a class that could perfectly well work on both the console and the browser (e.g. a client for a websocket protocol) you have to create and maintain two slightly different versions.
The text was updated successfully, but these errors were encountered: