zeromq.js
zeromq.js copied to clipboard
pure JS implementation?
Is your feature request related to a problem? Please describe.
I have issues building zeromq quite often. I want to use it in an NW.js app (NW.js is an alternative to Electron).
Describe the solution you'd like
I'd like to be able to build zeromq for use in NW.js but so far I've had no luck. I keep running into some problem or other.
Describe alternatives you've considered
I tried using npm rebuild zeromq --target=<same-version-of-node-as-with-nwjs> and nw-gyp with no luck.
Additional context
If the lib were using pure N-API, it would be compatible with future versions of Node just like plain JS is. Another possibility is using Node's built in TCP API and implementing this in pure JS an eliminate the build requirements to get this running everywhere with ease.
The native library (libzmq) is a very stable piece of software and it may be a challenge to accurately implement all of it in JS. I welcome attempts to try to implement the ZeroMQ protocol in JS, but it might makes more sense to do that in another project for now? Note there is also https://github.com/zeromq/JSMQ which aims for the browser, maybe some code could be shared.
The native libzmq is absolutely not a stable piece of software. It will terminate the running process as soon as it encounters a network error code it doesn't recognize (see zmq::wsa_error_to_errno) We currently use it in electron, it causes random crashes fairly frequently and due to the way it reports the error (logging to stderr) we don't even see the error code causing it.
To add insult to injury, zeromq.js doesn't even provide pdbs with the .node files, so we had to rebuild the entire thing just to figure out where the crash is coming from.
I will look into using JSMQ because then at least we'd be able to catch errors and - you know - handle them, instead of the process just going poof. EDIT: meh, JSMQ isn't even an option if all it supports is websockets...
checkout in development zeromq/jszmq