Giter Site home page Giter Site logo

Comments (14)

nkzawa avatar nkzawa commented on July 24, 2024

+1

I would add you as a collaborator if you want.

from socket.io-stream.

AaronO avatar AaronO commented on July 24, 2024

That would definitely be nice.

I'm going to be actively using this for various parts components of my startup (https://friendco.de).

So I'll most likely have improvements and bugfixes to submit in the future. (I just started using and looking into socket.io-stream this evening btw).

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

added you as a collaborator.

from socket.io-stream.

AaronO avatar AaronO commented on July 24, 2024

Thanks

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

Could you give me your name and email for the contributors field of package.json

from socket.io-stream.

AaronO avatar AaronO commented on July 24, 2024

Name: Aaron O'Mullan
Email: [email protected]

from socket.io-stream.

AaronO avatar AaronO commented on July 24, 2024

It's 3am here in California. So I'll look into this issue in the morning.

Thanks for your help.

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

Thanks a lot again. I will release the feature of duplex streams as v0.4.0 soon anyway.

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

Can you add tests for this?

I'm not sure but we should think how the allowHalfOpen option of duplex streams works.

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

I mean emitting end may not be enough when allowHalfOption is true, I'm not sure though.
Duplex streams have finish event too.

from socket.io-stream.

AaronO avatar AaronO commented on July 24, 2024

We should probably respect and support the allowHalfOpen option.

We could call Duplex.prototype._end in IOStream.prototype._end which would handle the emitting the end event as well as the allowHalfOpen logic on our behalf.

So if we do the above, in socket.js on sio.on('disconnect', ... (e1d9ec8#L0R106), we could then simply do something like :

sio.once('disconnect', function() {
      // Emit end correctly (with modified end function as described above)
      stream.end();

      // 'close' is optional for streams
      // but it makes sense here since it's the under laying transport (the socket.io socket)
      // which is disconnected/closed
      stream.emit('close');

      // Remove internal references
      cleanup();
});

What do you think of that ?

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

Does Duplex have the _end method ?
Maybe we need actual code to see what is good.

Give me time to think it anyway, Stream 2 API is too complicated for me :D

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

In my thought, streams have to emit close and error when sockets closed, since this is for when sockets were disconnected before completing to write and read data.
It looks like that end and finish events mean succeed.

from socket.io-stream.

nkzawa avatar nkzawa commented on July 24, 2024

I'm working this issue on the "allowHalfOpen" branch with the issue #6.

https://github.com/nkzawa/socket.io-stream/tree/allowHalfOpen

Tell me please If you have any other ideas.

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.