分块流不符合预期的Retrofit + RxJava

时间:2017-05-05 01:37:25

标签: android rest rx-java retrofit2

java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000

除非完成所有块,否则不会调用events()方法。

但是,大块的流预计将被大块交付,这似乎不会发生。

我已尝试使用和不使用@Streaming注释API,但行为是相同的。

我曾使用Android Retrofit 2 + RxJava: listen to endless stream作为参与我的实现

1 个答案:

答案 0 :(得分:5)

好的家伙我找到了答案。这是因为我使用Body属性

进行记录
logging.setLevel(HttpLoggingInterceptor.Level.BODY);

因此,由于记录器正在等待整个身体打印它,它的行为与问题中提到的方式相同。

参考:Square's Retrofit response parsing logic: streaming?