Sending data from node-red to local webpage - javascript

I'd like some help to my project, I do not know how to proceed.
Actually, I have a python code which send data to mosquitto and in my node I have a mqtt listener which get my data from my python code. Then I send those data to influxdb and then I use grafana to display my data in a time series graph. This works perfectly. My problem is that grafana allow you to display data with timeseries. Or I'd like to make X/Y plot.
So my idea is, from node-red and my MQTT listener, I send the data to a personal web page (this webpage could run locally in a local server, let's say localhost:1234 for example). On this server I run my index.html with some javascript on it and the plotly.js library which allows to make nice plot.
I have completly no idea how to send the data from node-red to a external webpage running on a local server. Someone could orientate me ? If you guys know some links or tutorial for this, it would be great.

Why bother with Node-RED, just use the paho Javascript MQTT client and subscribe directly to the MQTT broker from the webpage.

Related

How to connect Java client with node.js server?

I have to build a project that connects a Java application with a node.js server. I've already built the server part, it uses MySQL to store values and can process HTTP requests to return them in JSON format.
The Java app must be able to retrieve data from the server and then process it. The thing is, this application must be receiving information constantly from the server because it will be updating frequently.
Any hints on how to start or documentation you recommend to build this?
Thank you in advance.

Passing NodeJS data to Javascript

I have a web application with a client that receives data from a server. I have the data in NodeJS, but I want to pass the data to a Javascript file. The Javascript file is included in a HTML file, so I can't make the files communicate with eachother.
I am new to NodeJS, so it can be a stupid question, but anyones help is appreciated
This is for a project where I need have a data stream, and I need to pass it into a web application. I tried to pass the data to different page inside my application and then I tried to get that data on that page inside my web application via Javascript, but I couldn't make that work. I'm not even sure if its possible at this point.
Your node server can't communicate with your front-end without a specific way of communication like websocket, you have many other way to communicate with your front-end as node-server, take a look at server send event for example.
By the way your front-end can call your node server more easely with a get request as said #tomerpacific in comment.
For that you have to open a route with your express app. Routing with express
And for call it on a GET request, for that you can use the XMLHttpRequest, and if you have implemented jQuery on your front, you can use Ajax jQuery.

How to use ActiveMQ in Meteor?

I'm building a Meteor application that needs to receive JMS or AMQP messages, process them, and store the results in Meteor's MongoDB. I want this all to happen on the server, not the client.
I read the ActiveMQ AJAX page and that seems like a promising lead, but I don't know how to get it working. I was hoping to just create a new .js file in my project's server folder and put all the code in there, but creating the ActiveMQ AJAX servlet and importing the ActiveMQ javascript files seems to require HTML tags. Also, does AciveMQ need to be running for the servlet to work?
I'm new to web development.
You should take a look at node-amqp (https://www.npmjs.com/package/amqp). It should slip nicely into a meteor project and give you the functionality you are looking for. Once you install it and require it, you should be able to connect to your message server, create a queue, receive messages into the queue, and then it's just up to you to process them and store them to your mongo.

How to give Node.js server a command from php script?

sorry to bother you, but I've been looking for answers and I couldn't find them anywhere... Well i'm a fresh dude in the field of javascript and node.js and here's my problem:
I've created an application based on the tutorial of socket.io - Here's the link to the completed project of their chat example. everything is working as it should, but I would really need to trigger somekind of a command while node server is running... command should be triggered via php script.
The command should trigger an emit event - so every client in our case would see a new message sent via php.
I saw couple of suggestions to do it from another server with php/using cURL. The problem is that I don't know how to fetch POST data sent from php to node.js server.
Any solution to command node with php is more than welcome and again i'm sorry to bother you :)
You can use a bridge to exchange data between NodeJS and PHP. You will need to implement a PHP server that exposes remote procedures and a NodeJS client that calls those remote procedures. You can send any data to the NodeJS application from PHP using these remote procedures.
Here are a few links to get you started:
http://bergie.iki.fi/blog/dnode-make_php_and_node-js_talk_to_each_other/
https://github.com/bergie/dnode-php

Connect To Terminal Server

I have a site built in Javascript/PHP.
I have a terminal server that I can connect to using puTTy.
What I would like is to display the terminal server on the website.
I want to be able to send data to the terminal server through the code and display the response in the terminal screen.
I am not sure what could help me accomplish this. Are there any Javascript, PHP, Python plugins for this type of thing? I was able to play around with one PHP plugin but it only allowed me to send a command and get a response back. I would like to be able to actually see the terminal session as I would in puTTy.
You can use a Java applet for this.
http://weavervsworld.com/ssh/ssh.php

Categories