https://github.com/mohamedsamara/node-polling
Node Long Polling
https://github.com/mohamedsamara/node-polling
long-polling polling
Last synced: 7 months ago
JSON representation
Node Long Polling
- Host: GitHub
- URL: https://github.com/mohamedsamara/node-polling
- Owner: mohamedsamara
- License: mit
- Created: 2024-11-11T22:14:47.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T19:23:09.000Z (11 months ago)
- Last Synced: 2025-01-21T02:12:36.029Z (9 months ago)
- Topics: long-polling, polling
- Language: HTML
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node Long Polling
This project demonstrates a simple long polling mechanism for real-time notifications using Node.js and Express. When a client requests new notifications, the server checks for updates and responds only when new notifications are available. The client continuously polls the server and displays messages in the UI.
An **AbortController** is used to safely manage and cancel polling requests. The server also provides an endpoint to add new notifications, allowing the client to dynamically fetch and display updates. This approach provides an efficient way to push updates without constant polling or WebSocket overhead.