Giter Site home page Giter Site logo

Comments (2)

BiagioFesta avatar BiagioFesta commented on June 2, 2024

Hi,

The general idea is to follow the same approach used in the underlying QUIC library which makes sense to me.

With this approach only 2 types are requires (SendStream and RecvStream) providing simple and immediate API. They are 2 very well defined objects providing the 2 different functionalities (send and receive), single-responsibility principle.

Other libraries might introduce composite types. For example, s2n-quic, another QUIC library, uses multiple types and stream-functions: https://docs.rs/s2n-quic/latest/s2n_quic/connection/struct.Connection.html#
Multiple accept_* function with enum variants.


Maybe it was to unify the types with the unidirectional stream? (if that is the case, there can be a .split() function on this joined type that turns it into the two streams).

Indeed, this is true as well. I would avoid having UnidirectionalRecv, UnidirectionalSend and Bidirectional (for a total of 3 types) where Bidirectional overlaps code/functionalities.

However, I am not sure understanding your suggestion. How split works with unidirectional stream? (I would imagine split for bidirectional).


Moreover, current SendStream and RecvStream can be easily composable. I reckon you mentioned this, but I don't see how this might be complicated.

pub struct BiStream((SendStream, RecvStream));

impl AsyncRead BiStream { ... }

impl AsyncWrite BiStream { ... }

Maybe you can provide some code example also here, so we can see if we can find a better solution providing some helpers directly in wtransport.


Side note: calling them streams is a bit confusing, because they implement AsyncWrite/Read rather than Stream or Sink. (Edit: I guess this was done because the webtransport api calls them streams).

Yeah :)

This is a little bit inconvenient, but QUIC works with Streams.

Thanks

from wtransport.

BiagioFesta avatar BiagioFesta commented on June 2, 2024

Can you please have a look at: #135

Please add your feedback

from wtransport.

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.