0

I'm looking at this document in the Flutter documentation.

When executing this example from the Android or iOS emulator, everything works like expected. When I try it from my actual Android device (Pixel 2), the connect method states an error that the request was not upgraded. Looking into my server application (ASP.NET Core 2.1), the request headers of the emulator look like this:

Cache-Control
no-cache

Connection
Upgrade

Upgrade
websocket

User-Agent
Dart/2.0 (dart:io)

and others.

Whereas the request coming from my Pixel 2 device looks like this:

Cache-Control
no-cache

Connection
Keep-Alive

Accept-Encoding
gzip

User-Agent
Dart/2.0 (dart:io)

and some others.

The question is: Why does the Pixel not send an upgrade request? Looking into the dart SDK (_http package), the code does not give me any clue why it does not happen. Is this platform dependent, am I looking in the wrong direction?

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
Maik Mewes
  • 126
  • 1
  • 6
  • This is also the case when connecting to the server given in the example. – Maik Mewes Jun 04 '18 at 08:50
  • To clarify: it works over WiFi but not over cellular network. Does anyone know if this is intended behaviour in android? – Maik Mewes Jul 03 '18 at 11:11
  • For me running demo from a cookbook work as expected in both device and emulator in DEBUG mode. But running in RELEASE mode (flutter run --release), the WebSocket cannot make a connection to server. – tanutapi Jul 07 '19 at 15:26

0 Answers0