Giter Club home page Giter Club logo

Comments (2)

ptaoussanis avatar ptaoussanis commented on July 23, 2024 1

@vganshin Hi Vladislav,

I believe, that it is possible to detect closed TCP connection.

That is correct, but unfortunately browsers don't typically close TCP connections when refreshing a page (or following links, etc.). The underlying TCP connection is usually reused in these cases.

If the browser does explicitly close the connection (for example if the page includes "Cache-Control: no-store" or "Pragma: no-cache", etc.) then the http-kit :on-close event handler will fire as expected.

Otherwise you'll need to implement your own logic for detecting these kinds of discarded connections.

That's quite a large topic, but you can see Sente's implementation if you're looking for some possible ideas - here, for example.

I hope that helps?

from http-kit.

vganshin avatar vganshin commented on July 23, 2024 1

I got you. I knew (and successfully forgot), that browsers keep TCP connections alive. But I didn't thought that it reflects on server side in such a way.

Cache-Control, Pragma and even Connection: close headers didn't help. Anyway, async format it's not an issue anymore as it's needed in development. I just wanted to cleanup resources.

Thank you.

from http-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.