Giter Club home page Giter Club logo

Comments (6)

Dev1an avatar Dev1an commented on August 11, 2024 1

Maybe you can use the same api as the Readable Stream. So that you can change the encoding of messages using a method .setEncoding(encoding).

If you then want your new API to be backwards compatible with the current one, you could set the default encoding to "utf8". And users that need raw buffer access can simply call Zyre#setEncoding(null), an API they are already comfortable with since this is the common way to this in NodeJS API's.

from zyre.js.

interpretor avatar interpretor commented on August 11, 2024 1

Good idea! I will look into this and update the binary-messages branch.
Would be great if you test it when it's updated.

from zyre.js.

interpretor avatar interpretor commented on August 11, 2024

Yes, it's possible.
I am already testing it in binary-messages. I am just not sure about usability, because if I change the API, a console.log(msg) will result in a <Buffer 61 73 64 66>. You would have to use console.log(msg.toString()) to read string messages.
Sending messages would be no problem, as zyre.whisper() and zyre.shout() accept raw buffers as well.

If you want to test raw buffers now on your side, you could add "zyre.js": "interpretor/zyre.js#binary-messages" as a dependency in package.json.
Let me know how you think about it, and then we could add this in a new release.

from zyre.js.

Dev1an avatar Dev1an commented on August 11, 2024

Sure, I would be happy to test it!

And thanks for your nice API, it makes things way simpler than trying to use the official NodeJS Zyre binding 🙂.

from zyre.js.

interpretor avatar interpretor commented on August 11, 2024

I pushed a commit which adds support for multiple encodings plus the possibility to receive raw Buffers. d4fa967

from zyre.js.

interpretor avatar interpretor commented on August 11, 2024

Merged to master

from zyre.js.

Related Issues (8)

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.