Nodejs write file progress bar in html [closed] - node.js

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to generate a file in nodejs and I want to show writing file progress bar in the client-side HTML page. because I am writing a 5 lakh data into a file. once files generates complete in nodejs, it should notify users on the client side.

A typical design pattern for communicating server-side progress back to the client is to have the client establish a webSocket (or socket.io) connection to the server and then the server can send regular progress updates over the socket. When the client receives the updates and when it receives the final notification indicating completion, it can use Javascript to update the visual progress in the web page or do anything else it wants to in the page.
I would recommend using the socket.io library on both client and server as it makes things simpler than a plain webSocket.

Related

Real Time Notification on every processes in Node Js & Angular [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I want to show real time push notification to every user if someone started any kind off process. My project is in Angular and Node JS. If any user start some process then every user in the site should be notified by push notification
For your server side, you would need a socket solution to enable real time notification.
Since you are using NodeJs as your backend, you can try out socket.io. I personally find them quite easy to use. Their documentation can be found via their site.
https://socket.io/
If you need a step by step guide on how to combine nodeJS + socket.io + Angular, you can refer to this guide by DigitalOcean
https://www.digitalocean.com/community/tutorials/angular-socket-io
On the angular side, you need to develop a way to ensure the notification is consumed by all users. Two simple methods about this could
either be done via your state management like NGRX,
or via a global service

make a request to take server sent events in nodejs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a api that sends "server sent events" in real time. I need receive this data and process it in nodejs but all of information I´ve find refers to do capture events from a client side in a javascript code.
I don´t know if there are nodejs modules to do what I want in node.js
Regards
You can receive server-sent events in node.js with the eventsource module.
It is a pure JavaScript implementation of the EventSource client.

Socket.io or Rest API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I develop an application like Whatsapp using Vuejs and Nodejs. Can I create a backend for the entire application with Socket.io? Is it possible with Socket.io Rest api? I think there should be a Rest api in parts like the login. Is it true that I prepare parts like login with socket.io? Thanks in advance.
You can use a framework like NestJs or Adonis (or many others). Those that I'm mentioning are ready to build a REST service and also use websockets (with socket.io).
It is normal to use both in a project. The socket will be an open and persistent connection to the server, in the other case the http request is a petition, so ask yourself, Does this feature need constant communication with the server or could I ask for something and thats it??
Note: You can create a whole server using only sockets (socket.io in your case) but I think that a combination of ws + http is better

How can I make a desktop app with node.js in the backend for APIs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What would be the best set of technologies to use if I want to make a desktop application which would fetch data from server through JSON (node.js with MYSQL).
Side note: Currently we are using angular.js for frontend but the client wants a desktop app and is adamant. Don't want to change anything server side.
If you want to go ahead with js itself then you might want to look into electronjs you can even combine it with other frontend techs such as Angular, React or VueJs.
Another option is NW.js.
Look into both and choose as per your requirements both have pros and cons.

Web server in a game [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am implementing a 2-player tetris game on the web. One of my colleagues told me that I can implement it or use a web server.
Since this is a game, I think I must implement a server part. What is the point of using a web server in a game development?
The server keeps track of the game while the clients (the 2 people player Tetris) just deal with the UI and User inputs.
Server
The server should be in charge of making sure that moves are legal, calculating points, and anything else related to the rules and running of the game. This is where the logic of the game is or where the game is played.
Client
This is ONLY used for interacting with the server. There should exists a protocol between the Server and the Client. The client will only send requests to the server, wait for a response and update the UI appropriately. No game logic should be implemented here.
The purpose of the server is to talk to each of the clients and bounce data between them. If you need a server for your Tetris game you probably want to have a look into NODE.JS, PHP and WEB sockets.

Resources