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

[client] "closed" event isn't triggered on socket disconnect #115

Closed
andyrichardson opened this issue Feb 15, 2021 · 3 comments
Closed

[client] "closed" event isn't triggered on socket disconnect #115

andyrichardson opened this issue Feb 15, 2021 · 3 comments
Labels
question Further information about the library is requested

Comments

@andyrichardson
Copy link

andyrichardson commented Feb 15, 2021

About

When a socket is disconnected, the "closed" event isn't emitted

Reproduction

  • Pull this reproduction
  • Change the URL in the index.js to a valid endpoint
  • Run yarn start
  • Open browser and open console
  • Disconnect device from the network

Expected result

The following events are logged in the console:

  • connecting
  • connected
  • closed

Actual result

The following events are logged in the console:

  • connecting
  • connected

(no closed event)

Screenshot

Kapture 2021-02-15 at 17 48 11

Note: This issue is not exclusive to simulating offline network states (e.g. disconnecting device from network also has same result)

Debug Information

See repro

@andyrichardson
Copy link
Author

Closing as this is better encapsulated by #117

@michelepra
Copy link
Contributor

Online/Offline switch in chrome devtool not affect websocket connection.

To simulate connection lost in client side:

  • ✂️ network cable (😱 please not do)
  • disable network interface
  • unplug network cable
  • switch off wifi

If you have control of server

  • stop application
  • unplug network wire (virtual or phisical)

@enisdenjo
Copy link
Owner

As @michelepra said, the test case you provided is not valid. If you indeed think closed events are not dispatched, please do make a proper repro (or a failing test).

@enisdenjo enisdenjo added the question Further information about the library is requested label Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information about the library is requested
Projects
None yet
Development

No branches or pull requests

3 participants