Giter Site home page Giter Site logo

Comments (4)

peteruithoven avatar peteruithoven commented on July 24, 2024

On the server or the sending client?

from socket.io-stream.

peteruithoven avatar peteruithoven commented on July 24, 2024

I have a server where I sometimes want to abort/disallow a incoming socket.io-stream event. But I noticed that calling .end() on the stream doesn't destroy it on the client that send the event.

  socket.io-parser decoded 2/user,["$stream-end","b1819055-c2fd-4b95-9405-3809383befca"] as {"type":2,"nsp":"/user","data":["$stream-end","b1819055-c2fd-4b95-9405-3809383befca"]} +0ms
  socket.io-stream:socket end: "b1819055-c2fd-4b95-9405-3809383befca" +0ms
  stream _end +0ms
  stream push  +0ms null

This means that the streams will stay and when the server restarts I get a [Error: Connection aborted] on the client.

On the client I could check the acknowledgment callback and when there is an error message, I could end() the stream. But I'd like to do this on the server, is there a proper way?

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

@mtalal16 Maybe you can just call stream#pause or stream#cork.

https://nodejs.org/api/stream.html#stream_readable_pause

from socket.io-stream.

peteruithoven avatar peteruithoven commented on July 24, 2024

I'd like to warn for memory leaks. I think, on the broadcasting side, you need to manually call end() and destroy() to prevent the stream from hanging around.

from socket.io-stream.

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.