Coder Social home page Coder Social logo

Comments (5)

chrisdone avatar chrisdone commented on July 1, 2024

So from what I can see about message fragmentation, messages are split into multiple frames. So your Emacs API would be more aptly named :on-frame because it receives frames, which are part of some message.

So it seems like I can recreate a proper conceptual :on-message by using websocket-frame-completep to concatenate the contents of each frame until completep is t.

I think your existing API is good for streaming, so it'd be cool if it had both on-frame and on-message for the advanced or simple case. Closing, I can achieve what I need with this.

from emacs-websocket.

chrisdone avatar chrisdone commented on July 1, 2024

By the way, thanks for publishing this package, it's great! πŸ‘ πŸ˜„

from emacs-websocket.

ahyatt avatar ahyatt commented on July 1, 2024

My memory isn't perfect about this, but my recollection is that I should just be returning whole messages, not just frames. Looking at the code, websocket-process-input-on-open-ws should repeatedly read frames until the message is completed. websocket-read-frame is supposed to return nil if the frame is not completed, and it doesn't look like it does that. Perhaps that is the cause of this issue.

So, are you sure that closed is correct for this?

from emacs-websocket.

chrisdone avatar chrisdone commented on July 1, 2024

I'm not sure what's correct behavior for you. πŸ€” But I encountered this when making a message that's large, e.g. 100kb. I think you could literally just replace the data in my JS example with "a".repeat(100000) to reproduce this. ☝️

from emacs-websocket.

ahyatt avatar ahyatt commented on July 1, 2024

After reviewing the code, you're right in your analysis of this. It is documented that on-message actually deals with frames. Would you like to contribute a function to automatically concatenate messages to callback on a completed message? That might help other users.

from emacs-websocket.

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.