Questions tagged [server-sent-events]

SSE, also known as Server-Sent Events, form an integral component of the HTML5 standard. This technology enables a one-way persistent link between a client and server. Through SSE, the client can make a solitary request while receiving an uninterrupted stream of data from the server until the connection terminates.

Leveraging server-sent events (SSE) for real-time updates on a web client using JavaScript

I have been experimenting with server-side events (SSE) in JavaScript and Node.JS to send updates to a web client. To simplify things, I created a function that generates the current time every second: setTimeout(function time() { sendEvent('time', + ne ...

What is the most effective method for tracking file upload progress using SSE?

I am currently working on creating a file upload progress feature that is compatible with older browsers using AJAX. In HTML5, there is the xhr.upload.progress event which works well for modern browsers, but I need an alternative for non-XHR2 browsers. I h ...

A guide on testing RESTful web services using Mocha and Chai

I am a beginner when it comes to writing unit tests and I am currently learning Mocha and Chai. In my Node+express project, I have implemented a unit test as shown below: import { expect } from 'chai'; var EventSource = require('eventsource& ...

Managing incoming server events from multiple pods

Currently, I am developing a NodeJS server that has an /events endpoint for sending events to clients using SSE. In addition to this endpoint, there are multiple routes for handling POST requests. I am faced with the challenge of setting up this system so ...

Is it possible for me to utilize jquery and AJAX to invoke a cgi-bin script, and then incorporate a message event to manage Server Sent Event?

I have a cgi-bin program that runs for a long time (3-15 minutes) and I am looking to invoke it using AJAX. While the program is running, I want to receive Server Sent Event data from it and display it on my web page. It's like having a progress monit ...

The SSE functionality is effective in a local environment, but encounters issues when deployed on Vercel's

Operating a proxy server, I send a request to OpenAI which responds with a Readable Stream object. The proxy server then redirects these events back to the client. While my code functions properly on a local deployment, it encounters issues when deployed ...

Comparing Server Sent Events and Ajax with Websockets and Ajax

I am currently developing an application using Nuxt.js and facing challenges in determining the best approach for sending data to the API built with Express.js and receiving real-time updates. I have identified that "bi-di" connections can be established u ...

Is there a way to retrieve all active HTTP connections on my Express.js server?

In my express server app, I am implementing SSE (server send events) to inform clients about certain events. Below is the code snippet from my server: sseRouter.get("/stream", (req, res) => { sse.init(req, res); }); let streamCount = 0; class SS ...

What could be the reason for the onmessage listener not handling the initial SSE event?

When a client connects to a Node Express server, it creates a new EventSource. The server sends an SSE event upon initial connection and then at a 30-second interval thereafter. Strangely, the client's onmessage handler does not respond to the initial ...

A comprehensive guide on harnessing the power of server-sent events in express.js

After incorporating the express.js framework, I configured my REST server. Now, I am interested in integrating server-sent events (sse) into this server. However, upon implementing the sse package from npmjs.com, an error occurs. It seems that the error is ...