Closed 0x7d8 closed 1 year ago
https://github.com/uNetworking/uWebSockets.js/blob/master/examples/Backpressure.js
Isnt that just for websockets?
drain = onWritable send = write
same story otherwise, see docs
thanks! Turns out my actual problem with the flipping letters is caused by pausing & resuming the zlib stream for whatever reason. Still havent figured out why that does what it does but backpressure works fine
So Im trying to write relatively large amounts of compressed data and I obviously cant know the size, so I set on using chunked with write instead of tryEnd. for the tryEnd backpressure I used the VideoStream example. I tried to basically copy that 1:1 but replacing tryEnd with write and adding a .end() but the data seems to have flipped letters on the other side.
This is my current code I have, the getCompressMethod() function gives back the method (none, gzip, ...), the header value and a function that handles tryEnd & write, if method is none it uses tryEnd, else it uses write, it returns the first index of the tryEnd return and the return of write, so it always returns whether backpressure is ok.
(sorry for the identation)
What ive found yet is that the logs end at a Paused Log, so the write returns false but .onWritable is not executed after that. Not sure if thats related but may be good to know