I’ve spent the past two days trying to get my bot’s streaming to work, and I still haven’t been able to figure it out.
I’m using django for the server side and react for the client side. This whole time, I’ve been trying to set up a websocket between the two, but my client side code always will only start loading the message once all of the streamed chunks have been received.
My question for people who have done this, do you use webhooks or Server-Sent Events?
1 Like
Yes, people write stream parsers for the server side events.
If you’re using react you might want to look at a client library like @axflow/models (there are many others, they help do the streaming for you and give you a react hook).
1 Like
Appreciate the response. My django server is now working in sending my user message to OpenAI and streaming the response.
I’m just having trouble with taking the streamed response and showing it on the frontend. Is that where client library’s like @axflow/models come in? Thanks again
Yes, just google “axflow docs streaming”, and there’s a guide. You don’t need to use Axflow specifically (I have a bias, we built this), there are other options, but this will help you understand whats needed (the whole code is open source so you can go look at it also)