2团
Published on 2025-04-14 / 6 Visits
0
0

为什么不使用okhttp代理Server-Sent Events(SSE)

近期项目中需要实现Server-Sent Events(SSE)代理,最初技术选型是想基于OkHttp实现。

要使用okhttp代理,则需要额外引入okhttp-sse(4.12.0版本,2023.10.17)依赖,具体如下:

<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp-sse</artifactId>
    <version>4.12.0</version>
</dependency>

然而在跟踪源码的时候,发现okhttp-sse属于实验性支持,相关的API不保证稳定性,具体如下所示:

image-chtU.png

考虑到这个原因,放弃使用okhttp作为Server-Sent Events(SSE)代理工具。


Comment