I am have a huge headache from trying to get the ZMQ Node bindings working with Electron, especially on Windows. I am working on Windows 7 and Ubuntu 16.04 and both of them have two separate issues.
On Windows, I get an error when I try to do require('zmq')
C:\vueelectron\app\node_modules\bindings\bindings.js:91 Uncaught Error: Could not locate the bindings file. Tried:
→ C:\vueelectron\app\node_modules\zmq\build\zmq.node
→ C:\vueelectron\app\node_modules\zmq\build\Debug\zmq.node
→ C:\vueelectron\app\node_modules\zmq\build\Release\zmq.node
→ C:\vueelectron\app\node_modules\zmq\out\Debug\zmq.node
→ C:\vueelectron\app\node_modules\zmq\Debug\zmq.node
→ C:\vueelectron\app\node_modules\zmq\out\Release\zmq.node
→ C:\vueelectron\app\node_modules\zmq\Release\zmq.node
→ C:\vueelectron\app\node_modules\zmq\build\default\zmq.node
→ C:\vueelectron\app\node_modules\zmq\compiled\6.1.0\win32\x64\zmq.node
I've tried compiling with VS 2013 and 2015, rebuilt multiple times, used electron-rebuild
nothing seems to be working.
On Linux it loads up fine but the problem is that when I send a message, it seems to get stuck in a loop somewhere and it keeps sending sending hundreds of messages and goes on doing that indefinitely. This was resolved by upgrading from the version of ZMQ in the Ubuntu repositories to the latest one downloaded from the ZeroMQ website.
This is the code I used in my index.html
file of my Electron app.
const electron = require('electron')
const zmq = require('zmq')
const socket = zmq.socket('req')
socket.connect('tcp://10.10.0.51:3111')
socket.on('message', function (data) {
console.log(socket.identity + ': answer data ' + data)
})
socket.send('test')
Has anyone else been able to get Electron + ZMQ working? If so, what is your development enviroment like? Thanks.