Skip to content

dart:io websocket readyState / closeCode / closeReason doesn't changed after connection failed or closed #33362

Open
@nailgilaziev

Description

@nailgilaziev

Dart VM version: 1.24.3 (Wed Dec 13 23:26:59 2017) on "macos_x64"
dart:io used for Flutter, but I think is a general problem.

Background info:
App sends string messages to echo server and displays returned response.
WebSocket configured to send Ping Pong Messages.
All works fine - messages sended and received.
To emulate bad network conditions I use Apple Network Link Conditioner with 100% packet loss profile.
full code snippet for flutter here - https://pastebin.com/wLfAkS5N

UPD: updated code available in comment below


Problem is next:
Firstly, with good network conditions we are succesfully connected to our ws server. ws is connected and messages sended and received fine.
If we print now

print("ws ready state = ${ws.readyState}");
print("ws close code = ${ws.closeCode}");

we saw this:

ws ready state = 1
ws close code  = null

After we are switch our network to 100% packet loss profile.
Because we already configured ws heartbit by ws.pingInterval = new Duration(seconds: 10);
in some point in future we get an error in this callback:

ws.done.then((v) {
          setState(() {
            ex = new Exception("Connection is done with v=$v");
            print("DONE");
          });
        });

But ws ready state and close code is not changed!!!

ws ready state = 1
ws close code  = null

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions