Next.js Discord

Discord Forum

My backend is sending streaming responses how can i handle them in frontend

Unanswered
Blue swimming crab posted this in #help-forum
Open in Discord
Blue swimming crabOP
Any suggestions would be helpful backend is sending llm responses

5 Replies

that depends on what the content type actually is and what stream it is
is it being sent via SSE? then you need EventSource api. If its a socket event stream then that respective socket library and if its a normal http stream, fetch would do
@Yi Lon Ma that depends on what the content type actually is and what stream it is
Blue swimming crabOP
What should be done if has two choose from the 3
what?
@Yi Lon Ma what?
Blue swimming crabOP
like from backend what is the best way to send and then interpret in fe