Skip to content
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

Need to handle long text inputs #77

Open
ahyatt opened this issue Feb 18, 2024 · 1 comment
Open

Need to handle long text inputs #77

ahyatt opened this issue Feb 18, 2024 · 1 comment

Comments

@ahyatt
Copy link

ahyatt commented Feb 18, 2024

In investigating ahyatt/emacs-websocket#60, I looked at this package and tried to reproduce the error in it. I wasn't able to, because I found another issue: in atomic-chrome-on-message, it does not handle incomplete frames (frames in which completep is false). So it fails on parsing the frame as json, because you really have to combine two frames to read the completely json.

It's possible that we can solve this on the websocket side, but I'm hesitant to be combining frames, essentially faking frames, at least as a default behavior. So either way, something in this library would need to change. Let me know what seems reasonable to you. I can't promise a fix on the websocket side, because it might be infeasible for some reason, but I can at least look into it.

@KarimAziev
Copy link

I've addressed the incomplete frames issue in my fork: KarimAziev/atomic-chrome, which also contains other changes. @alpha22jp, if preferred, I can create a separate pull request with just this fix for easier review.

KarimAziev added a commit to KarimAziev/atomic-chrome that referenced this issue Mar 12, 2024
…lpha22jp#77

This commit introduces handling for fragmented websocket frames in
the atomic-chrome Emacs extension.

A new hash table, `atomic-chrome-frame-socket-incomplete-buffers-hash`, maps websocket
sockets to buffers that accumulate payload fragments from incomplete
websocket frames.

This allows for efficient handling and concatenation of large and/or
fragented messages. The `atomic-chrome-on-message` function has been
updated to accumulate payload fragments in a dedicated buffer when
frames are marked as incomplete or a previous incomplete frame exists
for the socket. Upon receiving the final fragment, the full payload is
reconstructed, decoded, and processed as a JSON object to either
create or update associated Emacs buffers for editing.

Additionally, the `atomic-chrome-on-close` function now
removes the associated buffer from the hash table when a websocket
socket is closed.
KarimAziev added a commit to KarimAziev/atomic-chrome that referenced this issue Mar 12, 2024
This commit introduces handling for fragmented websocket frames in
the atomic-chrome Emacs extension.

A new hash table, `atomic-chrome-frame-socket-incomplete-buffers-hash`, maps websocket
sockets to buffers that accumulate payload fragments from incomplete
websocket frames.

This allows for efficient handling and concatenation of large and/or
fragented messages. The `atomic-chrome-on-message` function has been
updated to accumulate payload fragments in a dedicated buffer when
frames are marked as incomplete or a previous incomplete frame exists
for the socket. Upon receiving the final fragment, the full payload is
reconstructed, decoded, and processed as a JSON object to either
create or update associated Emacs buffers for editing.

Additionally, the `atomic-chrome-on-close` function now
removes the associated buffer from the hash table when a websocket
socket is closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants