Single-Poll Server Event Mechanism for UI Reactivity
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing polling mechanisms for server events result in a high number of client requests, leading to increased server traffic, database access, and costs, while also causing UI components to present stale information.
Innovation Solution
Implement a single-poll request mechanism where the client polls the server only for events stored in the server's cache, reducing the number of client requests and eliminating the need for frequent database access.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the client polls the server frequently for each UI component event, then the UI components can remain reactive and up-to-date, but the number of client requests increases leading to increased server traffic and database access
Solution Approach 1:
Multiple individual polling requests from different UI components are merged into a single consolidated polling request. The server maintains a list of events and their timestamps, and the client polls this single endpoint to receive all relevant events, thereby reducing the total number of requests while maintaining UI reactivity.
Solution Approach 2:
The single polling endpoint serves multiple UI components simultaneously, providing a universal solution that replaces numerous component-specific polling mechanisms. This multi-functional approach allows one endpoint to handle event queries for multiple components, reducing server traffic and database access.
2Loss of information
If the client polls the server for every UI component event, then the UI can present current information, but the server load and costs increase
Solution Approach 1:
The server pre-computes and maintains a list of events with their timestamps before any polling occurs. This preliminary preparation allows the server to quickly respond to polling requests without performing heavy database operations at the time of polling, thereby reducing server load while ensuring information freshness.
Solution Approach 2:
Instead of querying the database directly for each polling request, the server maintains a copy of event data in memory. This copying approach allows rapid response to polling requests without repeated database access, reducing server energy consumption while maintaining up-to-date information.
3Reliability
If multiple polling requests are sent for server events, then comprehensive event coverage is achieved, but the complexity of the polling mechanism increases
Solution Approach 1:
The polling mechanism is segmented into distinct responsibilities: the server maintains and manages the event list with timestamps, while the client simply polls and processes the returned events. This segmentation simplifies the overall mechanism by clearly defining boundaries and reducing interdependence, thereby reducing complexity while maintaining comprehensive event coverage.
Data Source
AI summary
A device, system, and method are provided. In one example, a method for polling for server events is described that includes storing, on a server, a list of events. The method also includes polling, by a client, the server for the list of events. The method includes receiving the list of events stored on the server. The method further includes broadcasting each event in the list of events received to an associated component; and requesting, by each component that receives at least one associated event, component related event data for each associated event.


