1

我是 Pebble 的新手。最近写了一个简单的程序,让pebble客户端通过轮询的方式从服务端获取数据。我使用 Pebble.js、ajax 和 setInterval 函数。服务器位于 node.js 上。我遇到的问题是轮询在 20 多个查询后冻结,卵石没有任何变化,但仍然可以在服务器上获得查询信号。

客户端的代码在这里,服务端的代码是一个简单的http响应。

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);
4

1 回答 1

0

我自己解决了,原因:使用ajax时没有gc!

于 2015-01-04T17:39:57.567 回答