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

Why WebSocketChannel not allowed unsecure urls ? #1550

Closed
rkhkr opened this issue Jan 17, 2021 · 1 comment
Closed

Why WebSocketChannel not allowed unsecure urls ? #1550

rkhkr opened this issue Jan 17, 2021 · 1 comment

Comments

@rkhkr
Copy link

rkhkr commented Jan 17, 2021

E/flutter (29567): [ERROR:flutter/lib/ui/ui_dart_state.cc(184)] Unhandled Exception: Bad state: Insecure HTTP is not allowed by platform: http://192.168.111.20:8098
E/flutter (29567): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2435:7)
E/flutter (29567): #1604 _HttpClient.openUrl (dart:_http/http_impl.dart:2342:7)
E/flutter (29567): dart-lang/web_socket_channel#2 _WebSocketImpl.connect (dart:_http/websocket_impl.dart:1025:24)
E/flutter (29567): dart-lang/web_socket_channel#3 WebSocket.connect (dart:_http/websocket.dart:379:22)
E/flutter (29567): #1605 new IOWebSocketChannel.connect (package:web_socket_channel/io.dart:57:55)
E/flutter (29567): dart-lang/web_socket_channel#5 connect (package:web_socket_channel/src/_connect_io.dart:12:57)
E/flutter (29567): dart-lang/web_socket_channel#6 new WebSocketChannel.connect (package:web_socket_channel/src/channel.dart:106:48)

From Android 9 Pie and above its showing insecure error.
I got solution by adding android:usesCleartextTraffic="true" in android/app/src/main/AndroidManifest.xml

@robertpiosik
Copy link

robertpiosik commented Jan 20, 2021

For those having this appearing in search results, read more about the issue here.

@rkhkr rkhkr closed this as completed Jan 22, 2021
@mosuem mosuem transferred this issue from dart-lang/web_socket_channel Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants