Back

Realtime Stream Chunks Overloaded problem

  • 0
  • Realtime
Nour
1 Nov, 2023, 13:06

I’m facing an issue with the Realtime Stream Chunks Overloaded problem. I’m using the OpenAI chatcomplete API in my function and getting the response as streaming chunks. When I receive the chunks, I update a specific document on the DB and subscribe it in the client at every change. The issue I’m facing here is that updating the document for every chunk takes longer than getting all chunks without updating it. For example, if I get the chunks without updating the stream document for the real-time connection, it takes only 3 seconds. However, when I use Realtime, it takes about 13 seconds. Can I use another way to handle real-time without updating and writing the chunks in Appwrite, such as websockets or something else?

TL;DR
The user is experiencing an issue with the Realtime Stream Chunks Overloaded problem. They are using the OpenAI chatcomplete API and updating a document on the database for each streaming chunk received. However, this process takes longer compared to receiving all chunks without updating the document. They want to establish a real-time connection between the server and the client without writing to the database. They are asking if there is an alternative way to handle real-time, such as websockets. Solution: The thread does not provide a solution to the issue.
Drake
1 Nov, 2023, 14:55

However, when I use Realtime, it takes about 13 seconds.

Can you clarify what exactly is the 13 seconds? Is that the time it takes to update the document and receive all the chunks (in the function)?

Nour
2 Nov, 2023, 07:40

It's the time it takes to update the document only for all chunks. My problem is that I need to establish a real-time connection between the server and the client directly without writing to the database but the available channels on Appwrite are limited. Therefore, I chose to write to a specific document in the database and subscribe to it at the client.

Nour
2 Nov, 2023, 07:42

This operation takes more time during function execution and needlessly burdens the server with additional operations. So is there a way to establish a real-time connection between the server and the client directly for every user?

Nour
8 Nov, 2023, 09:58

??

Drake
13 Nov, 2023, 21:01

no

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more