I am new to Pebble. Recently I wrote a simple program for the pebble client to get data from the server by polling. I use Pebble.js, ajax and setInterval function. The server is on node.js. The problem I have is that the polling freezes after 20+ queries, with no changes on the pebble but can still get query signal on the server.
Code on the client end in here, and the code on the server end is a simple http response.
var UI = require('ui');
var card = new UI.Card({
title: 'Pebble.js',
body: 'Press any button.'
});
card.show();
var ajax = require('ajax');
setInterval(function(){
ajax({ url: 'http://182.92.151.205:20000/quote', type: 'json' },
function(data) {
card.body(data.quote);
card.title(data.author);
},
function(error){
card.body(error);
card.title('no');
}
);
}, 5000);
I solved myself, reason: no gc when using ajax!