zeromq.js | : zap : Node.js bindings to the ØMQ library | Runtime Evironment library

 by   zeromq TypeScript Version: v6.0.0-beta.16 License: MIT

kandi X-RAY | zeromq.js Summary

kandi X-RAY | zeromq.js Summary

zeromq.js is a TypeScript library typically used in Server, Runtime Evironment, Nodejs applications. zeromq.js has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

:zap: Node.js bindings to the ØMQ library
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              zeromq.js has a medium active ecosystem.
              It has 1308 star(s) with 196 fork(s). There are 36 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 94 open issues and 231 have been closed. On average issues are closed in 249 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of zeromq.js is v6.0.0-beta.16

            kandi-Quality Quality

              zeromq.js has no bugs reported.

            kandi-Security Security

              zeromq.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              zeromq.js is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              zeromq.js releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of zeromq.js
            Get all kandi verified functions for this library.

            zeromq.js Key Features

            No Key Features are available at this moment for zeromq.js.

            zeromq.js Examples and Code Snippets

            No Code Snippets are available at this moment for zeromq.js.

            Community Discussions

            QUESTION

            Working with multiple sockets in one thread using ZeroMQ.js
            Asked 2020-Aug-10 at 00:38

            I am trying to implement a service using ZeroMQ and Node.js.
            I am using the ZeroMQ.js bindings for it. The ZeroMQ Guide shows how to process multiple sockets in one thread: using the zmq_poller.
            I am trying to implement something similar in Node.js but I can not find a good way how to do this.
            I tried using Promise.race() like so:

            ...

            ANSWER

            Answered 2020-Aug-10 at 00:38

            If you are just trying to read two sockets without any synchronisation then two asyncronous loops that await data may help:

            Source https://stackoverflow.com/questions/63241380

            QUESTION

            Using ZMQ_XPUB_MANUAL with zeromq.js
            Asked 2020-Aug-03 at 09:41

            I am trying to implement a pub/sub broker with ZeroMQ where it is possible to restrict clients from subscribing to prefixes they are not allowed to subscribe to. I found a tutorial that tries to achieve a similar thing using the ZMQ_XPUB_MANUAL option. With zeromq.js it is possible to set this option:

            ...

            ANSWER

            Answered 2020-Jul-31 at 16:11

            In case one has never worked with ZeroMQ,
            one may here enjoy to first look at
            "ZeroMQ: Principles in less than Five Seconds"
            before
            diving into further details


            Q : "Is there a way to call setSockOpt() with zeromq.js or is there another way to accept a subscription?"

            So, let me first mention Somdoron to be, out of doubts & for ages, a master of the ZeroMQ tooling.

            Next comes the issue. The GitHub-sources, I was able to review atm, seem to me, that permit the ZMQ_XPUB-Socket-archetypes to process the native API ZMQ_XPUB_MANUAL settings ( re-dressed into manual-property, an idiomatic shift ), yet present no method (so far visible for me) to actually permit user to meet the native API explicit protocol of:

            ZMQ_XPUB_MANUAL: change the subscription handling to manual
            ...
            with manual mode subscription requests are not added to the subscription list. To add subscription the user need to call setsockopt() with ZMQ_SUBSCRIBE on XPUB socket.
            /__ from ZeroMQ native API v.4.3.2 documentation __/

            Trying to blind-call the Socket-inherited .SetSockOpt() method may prove me wrong, yet if successfull, it may be a way to inject the { ZMQ_SUBSCRIBE | ZMQ_UNSUBSCRIBE } subscription-management steps into the XPUB-instance currently having been switched into the ZMQ_XPUB_MANUAL-mode.

            Please test it, and if it fails to work via this super-class inherited method, the shortest remedy would be to claim that collision/conceptual-shortcommings directly to the zeromq.js maintainers ( it might be a W.I.P. item, deeper in their actual v6+ refactoring backlog, so my fingers are crossed for either case & my full respect for their brave work ).

            Source https://stackoverflow.com/questions/63192448

            QUESTION

            zeromq.js - Await connection
            Asked 2020-May-09 at 09:12

            The documentation for connect method says,

            Connects to the socket at the given remote address and returns immediately. The connection will be made asynchronously in the background.

            But, await does not seem to be applicable as shown in their example of subscriber code.

            subscriber.js

            ...

            ANSWER

            Answered 2020-May-09 at 09:12

            Q : "what error(s) maybe raised by the connect() method?"

            In case one has never worked with ZeroMQ,
            one may here enjoy to first look at "ZeroMQ Principles in less than Five Seconds"
            before diving into further details


            The Error(s) part

            The ZeroMQ native API distinguishes ( unchanged since v2.1 ) these errors for this :

            EINVAL
            The endpoint supplied is invalid.
            EPROTONOSUPPORT
            The requested transport protocol is not supported.
            ENOCOMPATPROTO
            The requested transport protocol is not compatible with the socket type.
            ETERM
            The ØMQ context associated with the specified socket was terminated.
            ENOTSOCK
            The provided socket was invalid.
            EMTHREAD
            No I/O thread is available to accomplish the task.

            Yet your actual observer is dependent on the zeromq.js re-wrapping these principal states, so the best next step is to re-read the wrapper source code, so as to see, how these native API error states get actually handled inside the zeromq.js-wrapper.

            The remarks :

            The following socket events can be generated. This list may be different depending on the ZeroMQ version that is used.

            Note that the error event is avoided by design, since this has a special behaviour in Node.js causing an exception to be thrown if it is unhandled.

            Other error names are adjusted to be as close to possible as other networking related event names in Node.js and/or to the corresponding ZeroMQ.js method call. Events (including any errors) that correspond to a specific operation are namespaced with a colon :, e.g. bind:error or connect:retry.

            are nevertheless quite warning, aren't they?

            The await part

            The MCVE-code ( as-is ) is unable to reproduce the live-session, so best adapt the MCVE-code so as to get run-able and we can proceed further on this.

            Source https://stackoverflow.com/questions/61693959

            QUESTION

            nodejs zmq - received buffer data than actual message
            Asked 2020-Apr-02 at 07:39

            I am doing the example of pubsub from this link and managed to get it work.

            server.js:

            ...

            ANSWER

            Answered 2020-Apr-02 at 07:39

            You will want to convert a Buffer to string with toString() (defaults to utf-8 encoding)

            or you can use string-decoder from nodejs

            with stringDecoder.write(buffer)

            i.e. stringDecoder.write(topic)

            Source https://stackoverflow.com/questions/60985737

            QUESTION

            How to handle connection timeout in ZeroMQ.js properly?
            Asked 2019-Nov-25 at 13:42

            Consider a Node.js application with few processes:

            • single main process sitting in the memory and working like a web server;
            • system user's commands that can be run through CLI and exit when they are done.

            I want to implement something like IPC between main and CLI processes, and it seems that ZeroMQ bindings for Node.js is a quite good candidate for doing that. I've chosen 6.0.0-beta.4 version:

            Version 6.0.0 (in beta) features a brand new API that solves many fundamental issues and is recommended for new projects.

            Using Request/Reply I was able to achieve what I wanted: CLI process notifies the main process about some occurred event (and optionally receives some data as a response) and continues its execution. A problem I have right now is that my CLI process hangs if the main process is off (is not available). The command still has to be executed and exit without notifying the main process if it's unable to establish a connection to a socket.

            Here is a simplified code snippet of my CLI running in asynchronous method:

            ...

            ANSWER

            Answered 2019-Nov-25 at 13:42

            ZeroMQ decouples the socket connection mechanics from message delivery. As the documentation states connectTimeout only influences the timeout of the connect() system call and does not affect the timeouts of sending/receiving messages.

            For example:

            Source https://stackoverflow.com/questions/59029401

            QUESTION

            ZeroMQ Rebuild for Electron 5.1.0 fails with error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found
            Asked 2019-Aug-13 at 14:38

            I'm trying to install ZeroMQ into an electron application but I'm unable to rebuild the package for electron.

            I'm trying to install ZeroMQ for electron 5.1.0 on my Windows 10 machine. Details:

            OS: Windows 10 Electron: 5.0.8 node: 12.0.0

            As per the instructions in the README.md https://github.com/zeromq/zeromq.js/, I have followed this procedure:

            1) Install zeromq with npm npm install zeromq

            2) Rebuild for electron npm rebuild zeromq --runtime=electron --target=5.1.0 Notes: The documentation indicates that the target here is supposed to be the Electron version; however, this causes a 404 error as npm tries to go to https://nodejs.org/dist/v5.0.8/node-v5.0.8-headers.tar.gz which doesn't exist. I then thought to try the node version, but that leads to a 401 error. I then tried the zeromq version (5.1.0 as shown in command) which leads to this error:

            error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

            Googling this error brings up a lot of StackOverflow problems where the build tools are required. Looking a little ahead on the README.md led me to thing I could solve this problem using the next command.

            3) Install visual studio build tools npm install --global --production windows-build-tools This command is completed successfully and installs both the build tools and python2.7

            4) Rerunning the rebuild command in step 2 leads to the same error. I tried variations of this command: npm config set msvs_version 2013 using 2015 and 2017 as well.

            2013 and 2015 give this error: error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\\path\to\app\node_modules\zeromq gyp ERR! node -v v10.16.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zeromq@5.1.0 install: node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild) npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zeromq@5.1.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

            While 2017 gives this: error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 bui ld tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by select ing the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\\path\to\app\node_modules\zeromq\build\zmq.vcxproj] with a similar ending section as the other years produced.

            ...

            ANSWER

            Answered 2019-Aug-13 at 14:38

            In the end this was a visual studio build tools install error. I uninstalled visual studio using the visual studio installer and then reinstalled windows-build-tools.

            Source https://stackoverflow.com/questions/57400027

            QUESTION

            Run jest with electron instead of node
            Asked 2019-Mar-06 at 13:17

            To make a long story short, I'd like to run my jest tests (using CLI) with electron instead of node.

            It's relevant when using native module, because you need to build them using electron header while jest run them using plain node. So I must either build my native modules for my app (at least in dev mode) or my tests, I can't have both to work.

            In this thread they propose to use mocha, but I want to use jest, which is far more advanced and interact well with React. Note that I don't want to mock the native module, since I write integration tests.

            I opened an issue about the zmq github repo. One proposed solution is "to target your tests using ELECTRON_RUN_AS_NODE=true electron as your node runtime". This is a very good solution, since using electron will both make the test environment closer to the execution environment and solve my specific issue with native modules.

            I'd like to apply that, but I do no seem to be able to setup the jest CLI to use electron instead of node, and I have no idea where to start. Maybe I should run jest programmatically without the CLI ? But I might lose the nice test filtering features of the CLI.

            Has anyone solved this already?

            ...

            ANSWER

            Answered 2018-Mar-07 at 16:07

            "ELECTRON_RUN_AS_NODE=true ./node_modules/.bin/electron ./node_modules/.bin/jest works fine

            Source https://stackoverflow.com/questions/44164862

            QUESTION

            ZeroMQ (ZMQ) feeding VivaGraph graph on client side
            Asked 2018-Oct-22 at 20:51

            I'm building a HTML page which renders a graph created using VivaGraph ( https://github.com/anvaka/VivaGraphJS ) .

            This graph should be fed by data coming from a ZMQ (ZeroMQ) datastream, where my webpage is connected as "Subscriber" to a "Publisher"; the perfect example code is here: https://github.com/zeromq/zeromq.js/#pubsub

            The problem is: VivaGraph is for JS on client side while ZMQ is for NodeJS environment.

            How can bind my VivaGraph graph to the ZMQ data stream in the client side?

            ...

            ANSWER

            Answered 2018-Oct-22 at 20:51

            You could look into libraries like JSMQ or zwssock that implement ZMQ over websockets, however these seem harder to use.

            I would go the easy way and place a simple express http server in the middle. Html client sends periodical get requests to the express server, server connects to ZMQ and fetches the data and sends it back to the client as json.

            Alternatively, you could also do a websockets connection between the html client and the server, while the server also maintains a connection to ZMQ and pipes data to the websockets.

            Source https://stackoverflow.com/questions/52878396

            QUESTION

            Using zeromq.js to communicate from a nodejs app with a python backend
            Asked 2017-Sep-21 at 02:23

            I have a python program that will accept a ZeroMQ REQ Requester and provide a number of functionalities, based on the given code.

            So if a client sends a code 02, python will return back a memory statistics, 03 a CPU statistics and so on.

            The client is created with nodejs and zeromq.js, in order to communicate with the backend. I am not sure what the best way would be to send multiple messages from the frontend, since I will send multiple such messages with different codes each second.

            What I have now is something similar to this:

            ...

            ANSWER

            Answered 2017-Sep-21 at 02:23
            Why is this happening?

            ZeroMQ uses distributed actors-model for a sort of multi-party behaviour in each of their pre-defined Formal Scalable Communication Archetypes.

            The REQ is just a one part of such multi-party distributed-behaviour.

            The opposite and symmetrically cardinal and necessary part is the REP node.

            The complete picture of this distributed-behavioural game ( called REQ/REP ) is this:

            REQ asks,
            REP replies ( yes, first has to receive and indeed read the message & then mus send an answer ),
            REQ can only, after having .recv()-ed ( un-loaded ) such an answer from REP, go and ask again the REP for getting another reply...

            This means, your code has to internally get aligned with this and coordinate it's local behaviour so as to meet this distributed-computing behavioural game.

            Ignoring these hardwired rules means a problem -- your REQ-side code n now seems, that it just remains inside its self-locked FSA-state ( wanting to send next messages ), where it simply somehow forgot to also .recv() the first and subsequent answers, that have ( or will have ) arrived from REP-side after the REQ's first .send(), and thus the REQ will never be able again ( until the reset, as was explained above ) to .send() any "next"-message anymore to the REP-part.

            Source https://stackoverflow.com/questions/46332037

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install zeromq.js

            Install ZeroMQ.js with prebuilt binaries:.
            Node.js 10.2+ or Electron 3+ (requires a N-API version 3+)
            The following platforms have a prebuilt binary available:. If a prebuilt binary is not available for your platform, installing will attempt to start a build from source.
            Linux on x86-64/armv7/armv8 with libstdc++.so.6.0.21+ (glibc++ 3.4.21+), for example: Debian 9+ (Stretch or later) Ubuntu 16.04+ (Xenial or later) CentOS 8+
            Linux on x86-64 with musl, for example: Alpine 3.3+
            MacOS 10.9+ on x86-64
            Windows on x86/x86-64

            Support

            ZeroMQ.js API reference.ZeroMQ project documentation. Note: The Node.js examples on zeromq.org do not yet reflect the new API, but the Guide in particular is still a good introduction to ZeroMQ for new users.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries