0

I need to set up a nested Server-Sent Events (SSE) connection (client -> backend -> OpenAI), and I have successfully achieved this. However, now I need to send a large text parameter (param) from the client to the backend to trigger the appropriate SSE endpoint. The text is too large to pass directly in the URL. Is there a way to send an initial packet from the client to the backend and then establish an SSE connection?

My current approach is to perform the following two steps:

Send a POST request with the large text, which generates a token and saves it to the cache. Initiate the SSE connection and retrieve the token from memory. Is this the standard approach for handling large parameters in SSE connections?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Andy
  • 109
  • 1
  • 3
  • 14

1 Answers1

1

Your approach is how you have to do it. (Or something equivalent, such as server-side sessions, and storing the data in the session.)

This is because the SSE standard does not allow using POST. (see also my answer at https://stackoverflow.com/a/34285526/841830 )

Darren Cook
  • 27,837
  • 13
  • 117
  • 217