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

Flaute WebApp Chrome Webhost is not supporting dart.html #54

Open
xunreal75 opened this issue Feb 23, 2023 · 9 comments
Open

Flaute WebApp Chrome Webhost is not supporting dart.html #54

xunreal75 opened this issue Feb 23, 2023 · 9 comments

Comments

@xunreal75
Copy link

connectanum in Flutter crashes because Websocket can't established on connect via dart.html

@konsultaner
Copy link
Owner

@xunreal75 Could you please provide a reproducer? I really don't understand what is ment by your error description.

@xunreal75
Copy link
Author

Hi,

I workarounded the connection by copying your websocket_transport_html.dart to my own app with following changes
removed dart.html //--> makes impossible to create a Websocket via ChromeApp
import 'package:universal_html/html.dart'; //this package can establish and acknowledge an Websocket

// at line 71I added
_socket = HtmlWebSocketChannel.connect(_url).innerWebSocket;
//_socket = WebSocket(_url, [_serializerType]);

@xunreal75
Copy link
Author

It's only wrong going in starting Flutter as Chrome Web App - although you show support WEB

@konsultaner
Copy link
Owner

@xunreal75 ok, maybe this is an issue with the conditional web package loading. I'll check it out.

@konsultaner
Copy link
Owner

_socket = HtmlWebSocketChannel.connect(_url).innerWebSocket;
What is the package you are using?

@xunreal75
Copy link
Author

Hi

for getting a connection I used 'package:universal_html/html.dart'; for testing purposes to open the connection

I had not more time to validate the connection ...

// at line 71I added
_socket = HtmlWebSocketChannel.connect(_url).innerWebSocket;
//_socket = WebSocket(_url, [_serializerType]);
//at line 77
_socket.onOpen.listen((open) => openCompleter.complete(open));
_socket.onError.listen((error) {
//Event //removed from function
openCompleter.completeError(error);
_onConnectionLost!.complete(error);
});

@xunreal75
Copy link
Author

Any news here for implementation in Flutter?

@konsultaner
Copy link
Owner

@xunreal75 Sorry, this is dart/sdk bug I already posted. I need to contribute to dart/sdk itself to get it to work with subprotocol. very enoying...

@konsultaner
Copy link
Owner

@xunreal75 I currently work on wasm support for this package. I reviewed your issue and saw that your code

_socket = HtmlWebSocketChannel.connect(_url).innerWebSocket;

doesn't use subprotocols. I bet your websocket server needs to configure the subprotocol?

Checkout my latest branch with package:web there is a working unit test with a websocket server. (delete the dart_test.yaml) before you run your test. you should manually run it with -p chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants