小程序目前没有直接支持SSE,但是有提供request的分块传输,但是使用分块去接收,读的这一次可能是一条json,也可能是json的一半,数据很难处理,建议还是使用小程序WebSocket来实现通信

代码示例:
javascript
const result = wx.request({
url: '',
enableChunked: true,
header: {
"content-type": "application/json",
"cache-control": "no-cache",
},
})
result.onChunkReceived(res => {
console.log('接收的数据:', res);
})