Giter Site home page Giter Site logo

Comments (18)

Redfire75369 avatar Redfire75369 commented on May 25, 2024 1

I've started work on ReadableStream in https://github.com/Redfire75369/spiderfire/tree/feature/readable-stream.
It will take a while, but it should be compliant with the WHATWG Streams spec.

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 25, 2024 1

Deno's implementation is written in JS. (https://github.com/denoland/deno/blob/d1f4d81dcf6a03463d82a89d058337acecca0588/ext/web/06_streams.js)

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 25, 2024 1

Streams: Writable & Transform

from spiderfire.

ARitz-Cracker avatar ARitz-Cracker commented on May 25, 2024

streams are the only thing keeping me from using this in prod btw, so implement streams and I'll help you END the V8 monopoly 😎

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 25, 2024

As of Bug 1795914, the Streams implementation in SpiderMonkey has been removed. Since streams are a relatively complex spec, this means they will delayed for now, while more important features are implemented.

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

Streams API (ReadableStream, WritableStream, TransformStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest) are implemented on Mozilla Firefox 116.0a1 20230703204942. It looks like WHATWG Streams are implemented in DOM: Streams https://bugzilla.mozilla.org/buglist.cgi?product=Core&component=DOM%3A%20Streams.

from spiderfire.

Arshia001 avatar Arshia001 commented on May 25, 2024

@Redfire75369 Rather than reimplement the streams spec from scratch, which will take considerable time, Spiderfire could use this fork of mozjs (which we're currently using for WinterJS): https://github.com/wasmerio/mozjs/tree/wasi-gecko

The fork uses this version of SpiderMonkey that has implementations for both readable and writable streams.

We also have an implementation for TransformStream (missing back-pressure ATM), TextEncoderStream and TextDecoderStream in WinterJS that could end up being useful to have in Spiderfire.

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 25, 2024

Although this is certainly an option, I have chosen not to go with that approach, since even if the relevant patches are reverted, the implementation is still unmaintained and may lead to issues when upgrading to more recent mozjs versions.

Also, last I checked, they never completed the WritableStreamimplementation.

from spiderfire.

sagudev avatar sagudev commented on May 25, 2024

It would be interesting if servo and spiderfire could share streams impl (at least part of it).

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

Isn't this all implemented using Rust? Deno's WHATWG Streams implementation works as expected. Just use what Deno uses?

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

Use that? Complie to WASM if necessary? Here's txiki.js' implementation in C https://github.com/saghul/txiki.js/blob/9cad93b8299cb61b6bcff081ac5a83b97c9d2404/src/streams.c.

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 25, 2024

The issue is not the implementation being written in JS per se. The issue is that its difficult to interface with streams and to have things like native sources through the Rust code.

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

I thought Rust was very flexible at JavaScript/WASM <=> Rust interface?

Anyway, you'll figure it out eventually.

from spiderfire.

Arshia001 avatar Arshia001 commented on May 25, 2024

@guest271314 you're probably thinking of wasm_bindgen, which is an entirely different story.

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

What I'm saying is various JavaScript runtimes have figured out how to implement WHATWG Streams. You any means necessary. wasm_bindgen, whatever. Just make sure the streams are transferable, the same as they are in the browser.

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

Additionally, make sure the streams actually stream. Bun had an issue with the ReadableStream implementation where in the server would read the entire stream before serving the data to the client. CloudFlare's Workerd implementation does not allow, by deliberate decision of the maintainers, an uploaded stream to be served to a subsequent request. Don't do that. That is one way we can implement close to full-duplex streaming in the browser https://gist.github.com/guest271314/4847c70be203ee7cd4c8a6d6a9bca1d3, save for the edge case of between a ServiceWorker and a WindowClient on Chromium, as WHATWG Fetch still has not spelled out the mechanics of full-duplex streaming in the browser, while deno and node both support full-duplex streaming using fetch() https://github.com/guest271314/telnet-client.

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

Pardon, the telnet-client repository is a different experiment, is one way I implement full-duplex streaming from the browser

from spiderfire.

guest271314 avatar guest271314 commented on May 25, 2024

I'll be checking back here periodically. FWIW just added spiderfire to this list https://gist.github.com/guest271314/bd292fc33e1b30dede0643a283fadc6a. Good luck!

from spiderfire.

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.