-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use zeromq.js in HTML page #264
Comments
You have to write a server side endpoint that will translate it to websockets, zeromq is a raw socket (TCP primarily). zeromq can not run directly in a web browser (unless it's in something like electron). |
If you want something that will run in the browser, you're probably looking for something built on top of WebSockets. For example, https://www.npmjs.com/package/socket.io |
You can also use plain WebSockets on the client-side and uWebSockets on the server-side, in-case you find socket.io quite bulky. WebSockets @ MDN: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket |
@rgbkrk Can ZMQ be run directly on Electron? How come it can be done there and not in a browser? |
Yes, it can. But you need to rebuild it as described in README file. The reason it works in Electron is that TCP sockets are available in Node.js and Electron, but not in client-side JavaScript in the browser. |
To add the the previous replies, there is support for WebSockets transport in progress. When it becomes available it will be supported in this library for server-side use. Usage in a browser will require JS-based client. |
Hello All,
It is not an issue, It is a query.
I am trying to create a web page [HTML] which will be creating the zeroMQ subscriber and will subscribe to a particular publisher. and will update the web page as and when it receive data from publisher.
Following is my code:
As I am new to this. I am not sure whether i am going in right direction.
Any help will be appreciable..
The text was updated successfully, but these errors were encountered: