Comments (6)
@sorenisanerd Yeah I realized back when first writing zmjs that the on_progress handler wasn’t all that useful.
ZMODEM can send data a few different ways. This library, since it assumes a reliable transport underneath, uses the option that forgoes error detection. In order for your chunkSize
idea to bear the fruit you envision, I think we’d also need to adjust zmodem.js to do “error detection” so we have an indicator from the peer of how far we’ve gotten. That would slow things down but might also be useful to prevent zmodem.js from locking the thread (which I’ve seen happen).
The WebSocket interface does expose bufferedAmount
, but things besides ZMODEM would be caught up in that, so that may not work very well. Ideally WebSocket .send()
would return a promise that fulfills once the message is sent, but alas, that’s not reality.
from zmodemjs.
I was working on a patch for this end and eventually learned about how the websocket API seems to have an infinite buffer, so we not only load the file almost instantly but also shove it into the websocket buffer almost instantly. Two steps forward, and one step back.
Like you suggest, requesting acknowledgment from the remote seems like the way forward. I tried simply changing the subpacket frame end for transfers from no_end_no_ack
/ZCRCG
to end_ack
/ZCRCW
in _send_interim_file_piece
, but zmodem.js seemed unhappy about the ZACKs from the other end.
I'll make do without progress indicators for now, but it would be real nice from a UX perspective.
from zmodemjs.
It would be real nice from a UX perspective.
I definitely agree! That said, as it happens I myself don’t have much use for it, so I’m not planning to work on it. I’d merge a good PR that includes suitable tests, though.
I envision something like: every 100th (10th? 1,000th?) ZMODEM subpacket requests asynchronous acknowledgement. That way there should be barely any perceptible impact on transmission speed, but there’ll at least be periodic progress indicators.
Alternatively, implement it with synchronous acknowledgement requests. That’ll impact transmission speed but also prevent zmodem.js from blocking the JavaScript thread, which is what I’ve seen happen when sending large files with it. (It might be a nice improvement—and maybe not too hard?—to convert the ZDLE conversion logic to WebAssembly.)
from zmodemjs.
I think synchronous is better for once. The max size of the websocket buffer is undefined and if it overflows, the connection is terminated unconditionally (per the spec).
I hadn't considered that the request for ACK is a per subpacket thing. Would it make sense to allow a callback function on the session or offer object so users can decide for themselves if they want to request a synchronous ack? Personally, I'd make it depend on the websocket's bufferedAmount.
from zmodemjs.
Note, though, that zmodem.js—by design—doesn’t assume WebSocket is involved. The library internals are transport-agnostic, which facilitates use in Electron apps and the like. So depending on bufferedAmount
won’t work.
from zmodemjs.
Yep, that's precisely why I was suggesting a callback option, so WebSockets aren't exposed to zmodem.js internals. 👍
from zmodemjs.
Related Issues (18)
- uglifyjs: SyntaxError: Unexpected token: name (ZmodemError) HOT 4
- Unhandled header! HOT 15
- Uncaught TypeError: Cannot read property 'ZRPOS' of null HOT 38
- Xtermjs + ssh2 ,How to use zmodemjs? HOT 5
- 'Zmodem.Browser' is Undefined HOT 1
- Uncaught RangeError: Maximum call stack size exceeded HOT 3
- Unhandled header! HOT 2
- Vue HOT 1
- Cannot read property ‘Sentry’ of undefined
- when sz in linux, crc32 failed HOT 11
- How do I exit upload or download on the zmodemjs
- Not receiving `OO` causes session to get stuck HOT 5
- Having trouble in cancel a upload process HOT 4
- After upgrade from 0.1.7 to 0.1.9 rz do not work any more HOT 50
- Ready enough for general usage? HOT 2
- xterm.js v4 and zmodem.js HOT 2
- how can i use this with jquery HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zmodemjs.