Support short polling
See original GitHub issueSometimes it might be handy to refresh query data, which could allow to have more “real-time” user experience. This is how I would go about it:
- To
RequestAction
addmeta.pool: number
(in seconds), this would be an interval, how often queries should be refetched automatically - We could implement it as a separate middleware (probably it would go even as 1st one in the stack)
- Of course this middleware should be disabled when running with
ssr: 'server'
PollingMiddleware
would just pass all actions through, but also it would check for queries withmeta.poll
, for which it would activatesetInterval
, repeating those actions, dispatching them again afterx
seconds- I think that dispatched query from this new middleware could also add
meta.pollCounter: number
, it could show us which time a given query is repeated, and also this could prevent poll looping - we shouldn’t create interval again for a query which is result of this middleware, otherwise we would have multiple intervals for the same query - Making a new request of the same type (type + requestKey) without
meta.pollCounter
should clear current interval (it really means than a new query was dispatched, not from middleware but outside), and, depending onmeta.poll
, possibly set new interval - we should add
stopPolling
action which should have the same arguments like for exampleabortRequests
- probably new flag should be added to
resetActions
but for now I won’t provide details asresetActions
is work in progress onpure-react
branch
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:21 (11 by maintainers)
Top Results From Across the Web
Amazon SQS short and long polling - AWS Documentation
Learn about the benefits of using Amazon SQS long polling to eliminate empty responses and false empty responses and to reduce your costs....
Read more >What is Long Polling and Short Polling ? - GeeksforGeeks
Short Polling : In a short polling client requests data from the server and ... We will understand short polling with the help...
Read more >Understand and Implement Long-Polling and Short Polling in ...
HTTP polling is a technique that we can use to build our real-time apps. In this article, you will read about what is...
Read more >Long and Short Polling
Short Polling. ○ Client makes a request to the server ... Short polling is an AJAX-based timer that calls at fixed delays ......
Read more >Short Polling vs Long Polling vs Web Sockets
Device support and fallbacks. Web Sockets. WebSocket is a computer communication protocol that provides full-duplex communication channels over ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@iwan-uschka @favger released in https://github.com/klis87/redux-requests/releases/tag/%40redux-requests%2Fcore%401.5.0
note that I didn’t implement pause and resume polling actions, because it can be just achieved by dispatching
stopPolling
and then, in a proper time by dispatching a given query withmeta.poll
againJust in case, if anyone started working on this, please let me know, as probably this is the next on my list, as I just published new version focused on React. If not, that’s totally fine, I just don’t want to duplicate our efforts 😃