Replies: 1 comment
-
You can refer: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/ReadableStreamDefaultReader |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
俺是个后端小白....
我前端这边跟本项目调用方式类似,fetch:
koa这边,我给个我的demo,每隔一秒钟发送一个字符,直到所有字符全部发送。
我这样调用时,f12那边会变成这样:

我这种方式拿到的char结构是data: xx\event: xx\nid: xx\n这种字符串,需要我转换成json才能拿到data里面的值,我是觉得这里挺耗费性能的,我需要用下面的函数去转换:
因为我看/api/generate返回的还是正常的Preview,所以想问问本项目/api/generate接口是用类似sse的方式实现的,还是用别的方式?如果是别的方式,能给个最简实现吗,谢谢大佬!

Beta Was this translation helpful? Give feedback.
All reactions