Multiple http responses

I am getting in trouble with this: I have an http-in node which starts a flow. Now I need to send responses to the client as soon as the nodes are completing their task (not all at the end, but as they happen). Of course I am bumping into the "headers already set" error...

You can only reply to an HTTP request once. Once it has been replied to, the connection is closed. We do not support streaming multiple messages back to the client over an open connection.

There are various options, but one would be to use a Join node (or similar) to block until you have all of the tasks completed, and then send just one response back.

Yes, I am currently using the join node to send a final response, but of course it is blocking and the user does not have the "feeling" of the undergoing process. No problem, thank you.

Why not use a websocket connection? Then you can pass as many responses as you like. You just send the page structure and scripts once.

You can do that manually using http-in/-out and websocket nodes. Or you could use Dashboard or you could use uibuilder which will let you define your static page and gives you the websocket connection with some easy helpers for your front-end code so you don't have to bother with writing your own websocket and event code.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.