Considering writing OutputStream from go block

15 views
Skip to first unread message

Phill Wolf

unread,
Mar 14, 2022, 7:03:45 PM3/14/22
to pedestal-users
If you want to return a streaming, synchronous response by writing to an OutputStream, you can make a web handler state the :body of the response as a fn, which will be called back with an OutputStream.  This is described at http://pedestal.io/reference/streaming.

That page goes on to say, "The function may run as long as it needs. This will occupy a thread, so consider using a go block."

The first sentence reassuringly emphasizes that the "fn" body option is for streaming a response.  But the implicit invitation to write to an OutputStream from a "go" construct seems strange.  Mightn't the writes block?
Reply all
Reply to author
Forward
0 new messages