What are the implications of sending xmlhttprequests to a server every second?

Currently in the process of developing a Chrome extension designed to monitor Gmail inbox activity.

To retrieve the necessary data, I am utilizing the XML feed URL:

For updating purposes, I've integrated the chrome.alarms API to execute a GET request every 10 seconds. Is this frequency too demanding? Would it be feasible to adjust it to 1 second intervals instead? Additionally, what level of server load is expected to accommodate the information exchange for providing me with the latest feed updates?

Answer №1

Implementing XHR every 10 seconds seems like a decent idea, however utilizing it every second may be excessive. Each XHR request establishes a new connection, resulting in the transmission of significant amounts of data to the server and receiving back a large amount of data. For real-time applications, it is advisable to opt for Websocket or Socket.io as they are lightweight, swift, and user-friendly alternatives.

Answer №2

Notification APIs (gmail seems to have them)

If you're looking for quick updates with minimal latency, consider using alternative methods such as "long polling" or "web sockets." These techniques are ideal for real-time applications like chat services, online games, auctions, and ticket/order queues where lag is not acceptable.

Gmail offers an API specifically designed for rapid notifications.


HTTP polling

Most web servers can handle being pinged once per second without any issues. However, if a server struggles with this frequency, it may indicate security vulnerabilities such as susceptibility to Denial of Service attacks.

Google's robust infrastructure can manage frequent requests, but keep in mind they may enforce rate limits on their Gmail API. Be sure to review their documentation to understand their restrictions.

While traditional HTTP isn't optimized for constant polling, you can still make numerous requests provided the data payload is small and processing demands are minimal. Bandwidth consumption may be a concern for users charged by usage time or data volume.

Consider the necessity of checking emails every second versus less frequent intervals. Adjusting the refresh rate based on activity levels can help conserve resources and optimize user experience.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering an error stating that 'coordinates should consist of an array with two or more positions'

Utilizing turf.js to generate a line depicting the path of an individual while their location is tracked. An array of coordinate arrays resembling Turf.js (lineString) is causing this error: Uncaught Error: coordinates must be an array of two or more posi ...

What could be preventing me from accessing global variables when using $.post in jQuery and returning a function?

let strTest = ''; $.post( 'test.php', { post_test : 1 }, function(data) { strTest = data.split('a'); $.post( 'test_2.php', { post_test_2 : 2 }, func ...

What is the reason behind Angular generating files with 'es5' and 'es2015' extensions instead of 'es6' (or no extension)?

Recently, I installed the Angular CLI (@angular/cli 9.0.1). My goal was to create a new Angular Element, package it, and then integrate it into another application. Following several blog tutorials, I found that they all mentioned the final step of creati ...

Triggering a Bootstrap 5 dropdown through code is only effective within the browser's developer console, rather than standard JavaScript implementation

I attempted to display a Bootstrap5 dropdown by clicking on a link in my web application. Despite trying various methods, such as dispatching events and utilizing the bootstrap Dropdown classes, I was unable to achieve success. Interestingly, both approach ...

Tips for implementing ng-click to work with the function result in href

Is there a way to pass the result of the ng-click function into the href attribute? Let's say I have: <a href="{{value}}" target="_blank" ng-click="myFunction()">Click Here</a> Where myFunction() dynamically generates a unique link from ...

Setting up SSL/TLS certificates with Axios and Nest JS

I have a Nest JS application set up to send data from a local service to an online service. However, the requests are not working because we do not have an SSL certificate at the moment. Can anyone provide guidance on configuring Axios in Nest JS to accept ...

The play button in the customized React AudioPlayer may sometimes need to be tapped twice in order to start

I've encountered an issue with my simple audio player (React/Vite) that transitions to the next track automatically or manually. Everything seems to be functioning correctly except for the initial press of the play button. The player opens with the pa ...

Issues arise when attempting to retrieve JSON data through an Ajax GET call. Specifically, an "Undefined" error occurs for all records in the JSON object

Here is the client side code snippet I am working with: $.ajax({ url: 'http://localhost/App.WebAPI/api/Messages/AppName', type: 'GET', dataType: 'json', crossDom ...

The context environment is failing to update the current state

Working with context in React can be tricky for some, including myself. I was hoping the new Context API would make things easier, but I'm still facing some issues. While I can get the initial value to display, the updates based on my Effect are not r ...

Preventing unauthorized access to files in ExpressJS public directories

Is there a way to conceal files served by the Node server? Despite my attempts to redirect certain files and directories, Express 4.X does not seem to cooperate. I have also experimented with sending 4XX HTTP responses when specific files are requested, bu ...

What is the method to generate an array of values using a single attribute in GeoJSON data?

Note: After reviewing some possible solutions mentioned in this thread, I found that .map is the perfect fit for what I need, which was not covered in the original post. Thomas's response below addresses my specific requirement. In JavaScript, how ca ...

Problem with Decimal Math calculations in AngularJS and JavaScript

I am experiencing an issue with JavaScript calculations. On inspecting the fiddle, I noticed that the answer is displaying as rounded with no decimals, which is confusing to me. How can I modify my code to display the decimals of $scope.total? var mome ...

How can I send a variable into the DOM using AJAX?

Apologies for posting a question earlier about creating a condition for checkbox without proper investigation. It appears that I need to pass my variables here. function setsession(sessionid, action, data) { $("#totalselection").show(); $. ...

How can I retrieve the available filters together with the search query in Elastic Search?

As a newcomer to the world of elastic search, I could use some guidance on querying. I'm also open to any suggestions on modifying my MongoDB Schema. I'm interested in finding out how I can use elastic search to display available products based ...

Is there a way to transfer textbox value to ng-repeat in AngularJS?

1) The Industry dropdown menu corresponds with a code textbox. Depending on the selected industry, the code will change accordingly. 2) There is a dynamic feature to add or delete Movie Names and Directors' names. In this table, there are three colu ...

Error: The function this.saveAlpha is not recognized in the current context at eval

This code features a start button, stop button, and a timer. The goal is to retrieve information from the phone using events like DeviceOrientationEvent, which includes properties such as absolute, alpha, beta, and gamma (referenced in this link: here). I& ...

Employing both Angular 1 and Angular 2 in conjunction

As a newcomer to angular, this is my first experience. My ultimate goal is to incorporate the following component into Angular 2: While I have some knowledge of JavaScript, I am attempting to integrate an Angular 1 library into an Angular 2 project. Aft ...

Simple methods to minimize the iteration of array loops in Node.js

First, retrieve the "grid_id" from the "grids" array ( Step 1 ) Next, verify if this "grid_id" is present in the "variationsDB" array ( Step 2 ) Once you have this "grid_id", use it to fetch the "var ...

The URI entered is not valid: The parsing of the hostname failed. Electron Builder

Having an issue while trying to build an electron app using squirrel, even though the iconUrl is valid. Here is my package.json configuration: "squirrelWindows": { "iconUrl": "http://95.85.39.111:5005/skylog.ico" }, Error message received: An unhand ...

Finding the Port Number where the NodeJS server is actively listening

I am currently facing an issue retrieving the port number on which NodeJS is listening. I have saved the port number value in the app.js variable and attempted to access it in the index.js file. However, I keep getting an undefined value in the index.js fi ...