Display data received through GRPC client on web page - node.js

I'm new in the GRPC world.
I need to display the data produced by some GRPC server on a webpage.
So I created a nodejs client to receive the stream of data which is working fine, but I need to show the results on a webpage and I have no idea how to do so.
Any help would be welcome

You can try to use the beta grpc-web https://github.com/grpc/grpc-web to access the gRPC service from the web. This works by setting up a gateway in the middle as per the grpc-web documentation.

Related

Nodejs - Transfer data between two server and client

I started to implement a HTTP ping health monitor as a private project with React and Node.js. I thought about making monitor with intervals that will send an axios request to server to receive all the urls and will return the results to server which will be shown later on in the client side.
I don't wanna use REST API to transfer data between the monitor and the server and to show it lively in the client side.
MONITOR <--> SERVER <--> CLIENT
What should I use instead of REST API in order to communicate between the monitor and the server? I know socket.io is fine to communicate between the client and the server but it is not so good for scaling.
What will be good and fast to transfer data for this specific project and not so hard to implement?
Thanks!
You can work with Server Sent Events in NodeJS, that is a way of receiving events from the server. Then you can use EventSource to open a connection to the server to begin receiving events from it.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
Take a look at this tutorial from DigitalOcean:
How To Use Server-Sent Events in Node.js to Build a Realtime App
Also take a look at Socket.io:
https://socket.io/

IHP - How to send and receive data between clients via custom Web Socket controller?

I'm building a chat application with a custom web socket controller and I want to establish a two way communication between different clients with the server in the middle in such a way that whenever a client sends a request, it gets updated on the server and the server emits a response to all the clients.
Note: I've tried using IHP's Auto Refresh but using that is turning out to be quite expensive for my use case so that's why I'm trying to set up a custom web socket controller.
Check out the new IHP DataSync API: https://ihp.digitallyinduced.com/Guide/realtime-spas.html
It's higher level than websockets but likely can help you implement the chat app.

How to get data from node backend to react frontend

I am creating a web app that uses react on the frontend and node on the backend. On the backend a web hook is used to get information about the status of a Twilio conference. Whenever the status changes, it gets posted to an endpoint on my backend. How do I get that information to the front end without constantly polling?
Twilio developer evangelist here.
You are looking for WebSockets, which are a constant connection between a front-end and back-end that you can send data over. If you are working with Node.js then you might find a library like Socket.io a helpful introduction to working with WebSockets. There is a tutorial for building a simple chat that will take you through the basics that you can then apply to this problem.

Transfer data from Node backend to React frontend

What I want to achieve is having a react application receive data posted to a Node-js server. Currently, the Node server receives a POST from an external source with a list of items. When the Node server receives the data, I want to send the data to the react application. This data will be used in the react application to display the listed items. How would I proceed to make this possible? Any advice is appreciated!
Thank you!
You can do this using Web Sockets. It would look something like this
Your app connects to your API and maintains a socket
The external source will POST to your API
API handles the POST request
Then the API passes some data on to the React app over the web socket
Your app consumes said data
Profit?
Socket.IO is a popular JavaScript library for web sockets with fallbacks and stuff.

Update Data in one webpage and displayed in other webpage

I need to update data(new offers or any other information) in a webpage. This update must be done by client and update must be displayed in the same webpage.
For eg: webpage called mirror.com and other webpage called mirror.com/update-
here,client will input data in mirror.com/update page and it must be displayed/updated in mirror.com page.
I'm using nodejs
Are you asking for real time updates? Then you have to use a Websocket connection.
You can use socket.io, sockjs or pusher.com for this. In the nodejs community , many people use socket.io. you can easily implement it into your project.
You have to build your own websocket server for socket.io and sockjs, but you don't want to do that when you use pusher. But socket.io, sockjs is much faster than pusher as i know. Because of when you use pusher , you have to connect to pusher server and grab the data back and then again you have to connect your own sever to display the data. But when you use socket.io or sockjs, you are working with the same sever.

Resources