DEV Community

Discussion on: Building with server-sent events with React and Node.js

Collapse
 
4shub profile image
Shubham Naik

Hi there, sorry for late response!

  1. I am not sure, could you rephrase this question?
  2. you should invoke res.end() when you want to close the connection.

Best,
Shubham

Collapse
 
wsh4and profile image
Eko Andri Subarnanto

Hi Shubham, thank you for your reply

  1. Let's say that I want to perform a long running query in the backend, and I want to inform the UI the percentage of how much it is done, say 10%, 20% and so on. Is it through a sse connection or with something else? So the backend keeps sending the 'value' of how much the query has been done? And which part close the connection, UI atau backend?
  2. Thank you.

Regards,
Andri

Thread Thread
 
4shub profile image
Shubham Naik

You could use an SSE connection for this yes, and then you could close the connection when value = 100?

Thread Thread
 
wsh4and profile image
Eko Andri Subarnanto

Oh I see, yes thank you for your reply