Hey,
I have this use case:
On the server I have a JSON file that changes (for example) every 15 minutes.
The client typically leaves his browser open and wants to see the changes as fast as possible.
On the server I solved it this way:
When getting the json file, the server uses a http 304 to indicate that the file hasn't changed since the last request.
Client side I solved it this way:
I have a kendo datasource, and an interval that is doing datasource.read (polling mechanism):
Problem:
The data isn't changed, but still the "change" event of the datasource is triggered.
Is there any way of achieving this with kendo datasource, without reprogramming the entire datasource with $.ajax?
Or is this maybe a good feature request :-) ?
As an extra: I don't want to use polling, but look at the Expires http header, to know when to do the next request.
My code:
The response received from the server looks like this:
Kind regards,
I have this use case:
On the server I have a JSON file that changes (for example) every 15 minutes.
The client typically leaves his browser open and wants to see the changes as fast as possible.
On the server I solved it this way:
When getting the json file, the server uses a http 304 to indicate that the file hasn't changed since the last request.
Client side I solved it this way:
I have a kendo datasource, and an interval that is doing datasource.read (polling mechanism):
Problem:
The data isn't changed, but still the "change" event of the datasource is triggered.
Is there any way of achieving this with kendo datasource, without reprogramming the entire datasource with $.ajax?
Or is this maybe a good feature request :-) ?
As an extra: I don't want to use polling, but look at the Expires http header, to know when to do the next request.
My code:
01.var datasource = new k.data.DataSource({02. transport: {03. read: {05. url: 'test.txt',06. dataType: 'json'07. }08. },09. schema: {10. data: function (data) {11. return data.Layers || [];12. }13. }14.});15. 16.//polling..17.var _interval = window.setInterval(function () {18. datasource.read();19.}, 5000);20. 21.datasource.bind('change', function (e) {22. //This shouldn't be triggered every 5 seconds23. console.log(this.data().length);24.});HTTP/1.1 304 Not ModifiedLast-Modified: Mon, 02 Sep 2013 08:02:11 GMTExpires: Mon, 02 Sep 2013 08:15:00 GMTAccept-Ranges: bytesETag: "383bbbab2a7ce1:0"Server: Microsoft-IIS/7.5X-Powered-By: ASP.NETDate: Mon, 02 Sep 2013 09:23:10 GMT