Giter VIP home page Giter VIP logo

Comments (5)

janthurau avatar janthurau commented on June 16, 2024 1

hmm yep we're still lacking documentation for this unfortunately. It's intended behavior as the socket can be created without a document connected/connecting (and should survive a document being destroyed as you can just open another one)

If you want to close the connection, you need to destroy the websocket provider as well (socket.disconnect() or socket.destroy()). Documentation is in the process ..

from hocuspocus.

janthurau avatar janthurau commented on June 16, 2024 1

Closing this, as the behaviour is intended. The memory leak has already been fixed by @raineorshine :)

from hocuspocus.

georeith avatar georeith commented on June 16, 2024

+1 I've been meaning to make a ticket about this, I'm manually destroying the websocket provider at the same time in our application.

from hocuspocus.

lin52025iq avatar lin52025iq commented on June 16, 2024

I think the problem in here.
#637

image

from hocuspocus.

romansp avatar romansp commented on June 16, 2024

I agree with the intended behavior described above but I noticed something else that seems unexpected.

I'm reusing single HocuspocusProviderWebsocket across multiple HocuspocusProvider instances and then manually destroy these when required (onBeforeUnmount hook in Vue). But it seems that provider doesn't unsubscribe properly from websocketProvider which leads to a memory leak.

For example, onStatus hook will still be called for websocket reconnect events later even after HocuspocusProvider has been explicitly destroyed.

Here handler is configured, but this.removeAllListeners() in destroy call won't unsubscribe this.

this.configuration.websocketProvider.on('status', this.onStatus.bind(this))

Will try to provide a minimal repro soon.

from hocuspocus.

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.