-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a flow control mechanism to the attach addon #1918
Comments
DomTerm keeps a running count of the number of bytes received and the number of bytes confirmed, which are tracked both in the browser and the (WebSockets) server. (Both of these counts are modulo 0x10000000 to deal with wrap-around.) When the difference between the number of received and confirmed bytes is larger than some threshhold (currently 500), then the browser sends a Similarly, the server keeps track of the number of sent and confirmed bytes. (The confirmed count is the most recent value of a DomTerm uses a "report-event" escape sequence for messages sent from the browser to the server. The byte-stream from the browser to the server contains primarily user key-strokes (encoded as in xterm), as well as these "event" messages. A domterm server needs to scan the stream for event messages and handle them appropriately. The xterm.js project concentrates on the browser part of the terminal, leaving the server part to embedders. I suggest adding an escape sequence that the server can send to notify xterm.js that the server understands these event messages, including the |
Yeah we dont want to focus more on the server side as this is left to integrators (could be build in any language/framework/whatsoever). Thus we might need some general way to indicate the server part "hey - slow down abit". We further might need to document some instructions for integrators how to achieve lossless handling of those "stop" and "go" signals in their server parts. In envs that cannot handle blocking things well ppl might struggle to set up things, esp. with nodejs and its non blocking control flow you can easily end up with exactly the same problem on server level. Maybe this is worth a wiki entry later on. |
@jerch correct me if I'm wrong but I think we landed on having some general guidance for flow control instead of implementing it within attach? It's relatively simple to do now that we have the write callback. |
We should not provide an out-of-the-box flow control mechanism in the addon, it depends way to much on the actual backend used and needs additional server code to work properly. Thus closing the issue. |
The old flowcontrol approach with XOFF/XON does not work in envs that disable flow control on the pty. Since many shell startup scripts disable it, we can remove it from
Terminal.write
.For local apps like electron based flow control can be achieved by avoiding async buffers in between, for remote apps we might want to add some flowcontrol mechanism to the attach addon.
The text was updated successfully, but these errors were encountered: