The way in which notifications for updates are displayed on the Stack Overflow website

Could someone shed some light on how the real-time update messages on this platform are created?

For instance, when I am composing a response to a question and a new answer is added, I receive a notification message at the top of the page. How is this functionality achieved?

I understand that HTML5 WebSockets or server-side technologies like ServerSocket could be used for this purpose. Are there any alternative methods to create similar push notification systems using Java, Spring, and jQuery?

I'm unsure about the correct tags for this question. Please advise if changes are needed.

Answer №1

SO utilizes the innovative reverse ajax/comet technology to display messages in real-time. I recall engaging in a conversation on meta regarding this functionality, though locating the exact link eludes me currently. I will provide an update once I locate it.

Depending on the programming language and framework used, the terminology may vary (e.g., websockets or socket.io), but ultimately they all stem from the comet framework.

Update:

For further insights, here is the discussion on SO meta pertaining to this topic.

Answer №2

My experience with the Direct Web Remoting framework has been extremely positive. (DWR).

Answer №3

There are multiple methods to accomplish this:

  • Polling: By utilizing JQuery, you can regularly send a request (e.g., every 5 seconds) to retrieve updates from the server.
  • Streaming: When you send a request, the server does not specify a Content-Length in the response and keeps the socket open indefinitely. This allows for data to be sent from the server to the client at any time. However, it also means that a connection is maintained by your server for each client.
  • Long polling: A combination of the previous two methods. The server maintains the connection but with a timeout. If no new data is available, the server closes the connection and the client reopens a new one after a period of time.

These are known as Push technologies: http://en.wikipedia.org/wiki/Push_technology

Naturally, there are other approaches to achieve the same goal.

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

Error: String index is out of bounds - Processing

I am currently developing a function that will extract the number before a specific delimiter in a given string, starting from a designated point. For example, if I input ("45,621,9", 0), it should return 45. The current implementation works perfectly unt ...

Locate and extract the JSON object using the specified key-value pair

Trying to extract a specific object from a complex json file, noting the key, and then returning a new json poses a challenge. I am using expressjs as the backend for this task. Sample.json '[{"ServID":"Rai 1","Parametri" ...

Upon rerender, React fails to refresh the style changes

I am encountering an issue with my React component where the visibility and position can be changed by the user. Currently, the visibility can be toggled by adding or removing a CSS class, while the position is adjusted through a function that updates the ...

Create a bookmarklet for Webdriver when initializing the driver, or store the bookmarklet in your saved bookmarks, all done without the need to

Need Help Adding Custom Bookmarklet to Webdriver I am looking for a way to include a custom bookmarklet (a bookmark that consists of pure JavaScript code) in a webdriver so it appears on the bookmarks toolbar. I would like to achieve this either during th ...

``There seems to be an issue with the Express app when trying to access it

I have set up an express app that I want other devices on the same WIFI network to access without requiring internet connectivity. The main computer hosting the app is assigned with a fixed IP address: 192.168.1.60 In my server.js file, I have included t ...

Learning about the functions Promise.all and Array.map()

My current project involves retrieving data from multiple APIs and aggregating them into a final array that will be displayed in the UI using React. Let me explain the scenario. First, I retrieve the main data from the primary API: const response = await ...

Modifying two distinct charts according to the choices made in two independent dropdown menus

In my current project, I am facing a challenge with integrating two separate dropdowns containing UFC fighter names. The goal is to display a plot showing the KD (Knockdown) data for the selected fighters over time when their names are chosen from both dro ...

The issue with PHP array not functioning properly when used alongside a while loop

My PHP code is giving me an error message when I try to display information in the browser: Notice: Array to string conversion in. Can someone help me with this? I need to display this information from a function without creating a new one for every requ ...

Creating a custom JavaScript library using an existing npm module (codius)

Embarking on a new journey with this, never tried it before. Currently utilizing https://github.com/codius/codius-host. The development of Codiu§ has been abandoned, however I am determined to salvage some parts of it for my own project. It is crucial fo ...

Encountered an error "Not Found" when attempting to establish an AJAX connection between Javascript and Rails

I'm having an issue with a simple Rails controller method. When I call it from JavaScript as an AJAX method, I get the error message "Not Found" in the JavaScript error log, even though the method works fine when accessed directly in the browser. What ...

Issue: NG04002 encountered post migration from Angular to Angular Universal

Having recently created a new Angular app and converted it to Angular Universal, I encountered an issue when running the project using npm run dev:ssr. The error displayed in the terminal is as follows: ERROR Error: Uncaught (in promise): Error: NG04002 Er ...

What could be causing the issue of PHP not receiving this multidimensional array through Ajax?

Having an issue with receiving a multidimensional array in PHP after posting it from JS using Ajax: $.ajax({ type: 'post', url: 'external_submit.php', dataType: "json", data: { edit_rfid_changes_submit ...

I'm curious about something as a beginner. Can you explain what **.config.js and **.vue.js files are? How do they differ from regular .js files

I have a simple question that I haven't been able to find the answer to through searching. I've come across files like vue.config.js generated by vue-cli, as well as files like Content.vue.js. At first, I assumed that after the period was the fi ...

Storing Objects in MongoDB using Node.js

I am working on an application where I need to store an object for later execution of functions. This object essentially holds the data of a cron job. var cronJobObject = schedule.scheduleJob(new Date(2018, 0, 19, 15, 15, 0), function() { console.log( ...

What is the recommended library for managing a task queue in this project?

Is there a library or package available for Node.js that can help me create a task queue with a fixed timeout between the start of each task and an overall callback that is triggered after all tasks have finished? https://i.stack.imgur.com/j1wCY.jpg ...

Enhanced Fancybox Version 2 adjusts iframe width to fit content

I have been attempting to adjust the width of the iframe in fancybox v2 to fit my content properly. However, every time I try, the content appears too large within the iframe and requires horizontal scrolling to view it all. My goal is to see the entire wi ...

Material-UI Autocomplete can only save and display one specific property of an object at a time

Can someone help me with implementing Autocomplete from Material-UI? I want to store only a specific property value and not the entire object. For example, let's say I want to store the property Value, but it could be any other property as well. con ...

Unable to transmit the element identifier information through ajax

Whenever I attempt to pass id data through ajax, I encounter an undefined variable error. The ajax function works smoothly with form data, but the issue arises when trying to extract the id value. Below is the PHP/HTML code snippet: <ul class="sub-men ...

Troubleshooting the non-functioning addEventListener in JavaScript

I am facing an issue where a function that should be triggered by a click event is not working and the console.log message does not appear <script src="e-com.js" async></script> This is how I included the javascript file in the head ...

What is the method for inputting a JSON array list into the application.properties file in a spring-boot application?

Is there a way to efficiently write a Json array list within the application.properties file in a spring-boot application, allowing for easy retrieval of the entire Json data? Here is an example of a json object: { "userdetail": [ { "user": "us ...