Giter VIP home page Giter VIP logo

Comments (5)

kanaka avatar kanaka commented on May 21, 2024

If you use include/websock.js then you really don't have to worry about what is happening on the channel. You can use send_string() and rQshiftStr() to send and receive strings. See the websock.js API

The focus of websockify and websocket.py is too support sending binary data back-and-forth between the browser. That's why the default send and receive format when using include/websock.js is an array of bytes and not strings (although string convenience routines are provided).

Once WebSocket binary API support is more prevalent in browsers I will be adding binary support to include/websock.js so that base64 is not needed (websocket.py already supports binary frames if 'binary' is in the protocol field).

I'm not fundamentally opposed to allowing non-base64 encoded strings to be sent/received, but I'm probably not interested enough to implement it myself. Also, it would need not to be a separate protocol value "raw_text" or something since base64 needs to be the default if no protocol value is specified (for backwards compatibility with existing applications). I've tagged this issue as "feature" and "patchwelcome".

from websockify.

jmcintyre avatar jmcintyre commented on May 21, 2024

Thanks for adding such a detailed explanation of the current state. Depending on performance impacts we discover in the next couple of months compared to our previous implementation, we may take you up on that patchwelcome.

from websockify.

kanaka avatar kanaka commented on May 21, 2024

Unless you are planning on sending several MB per second, I don't expect you'll run into a CPU performance issue (noVNC receives and decodes several MB/s pretty easily on recent browsers). base64 encoded data is about 25% larger then equivalent text so if bandwidth is your main issue (and you really are just sending plain string/JSON) then it might be worth it.

from websockify.

jmcintyre avatar jmcintyre commented on May 21, 2024

We're mostly concerned with latency issues, rather than pushing around lots of data. Having said that, I doubt we'll have any problems at all, but if we do, I'll make sure we pass on the results of any work on a raw text version. This project has been extremely helpful to us, thanks to you and everyone working on it.

from websockify.

kanaka avatar kanaka commented on May 21, 2024

websock.js and websockify now supports sending raw binary data (typed arrays) over the WebSocket channel without the need for base64 encoding. There is still an "encoding" step to convert normal javascript arrays to typed arrays and vice versa, but that can be an optimization if somebody wants to tackle it. I consider the base binary support to be complete.

This was commits: 376872d, and 068065e

from websockify.

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.