charton API / @chart-on/core / index / createPollingDataSource
Function: createPollingDataSource()
createPollingDataSource(
options):DataSource
Defined in: packages/core/src/data/adapters.ts:191
Live bars for HTTP-only sources: polls the history source's history method for the newest bars and streams them as if they came from a socket. Each poll is a 'refresh' request from the newest bar seen (the first poll has no from). The rule follows the chart's streaming contract, where a bar with the last time replaces it and a newer one appends:
- each poll sends, oldest first, every bar that is new or differs from the version sent last, so a late trade in the previous bar arrives before the next bar opens, and nothing unchanged is sent again;
- if the bar sent last is missing from the response (e.g. after the tab slept and more than
limitbars opened), the bars in between were missed, so the source reports a reset from it throughonReset, and the chart refetches the gap; the response's bars are still sent. A failed poll reportsreconnectingthroughonStatus, and the next good oneconnected, after which the chart refetches what it missed.