是否可以使用RxJava/RxAndroid和Retrofit来执行周期性的http请求,每隔x秒更新一次数据?
目前,我使用的是IntentService和递归处理程序/运行程序,它每隔x秒触发一次。我想知道是否可以删除所有这些,让RxJava来处理请求。
final RestClient client = new RestClient();
final ApiService service = client.getApiService();
public interface ApiService {
@GET("/athletes")
public Obs
我在AngularJS 2中使用了以下代码来发出轮询GET请求:
makeHtpGetRequest(){
let url ="http://bento/supervisor/info";
return Observable.interval(2000)
.map(res => res.json()) //Error here
.switchMap(() => this.http.get(url));
/*
This p
我正在尝试创建一个模拟服务器,以帮助更容易地为在事件流上操作的客户端编写测试。
我正在使用RxNetty实现服务器和客户端,我的问题是如何使用带有RxNetty的TestScheduler来控制事件何时发出。
下面是我的(简化的)服务器:
final Observable<Event> events = Observable.just(...);
final TestScheduler testScheduler = new TestScheduler();
final HttpServer<ByteBuf, ByteBuf> server =
我有一个函数可以轮询api,直到返回所需的结果或到达超时时间。
// sample poll, filter and timeout
pollStatus = (): Observable<string> => {
return Observable.interval(1000)
.mergeMap(() => this.getStatus(); // this makes a http call to a status api
.map((response) => respon