URLConnection and ContentReceived()

I just noticed today that the ContentReceived event fires for both Send and SendSync. Is this by design? I’m thinking about relying on that behavior…

The more I thought about this, the less useful for my situation I realized it is. So, I went about it differently. I am curious if the behavior is by design, though.

I suspect it’s just a side effect of the fact that the framework events fire anyway.

1 Like

I thought I’d mention something about this event as it caught me out yesterday whilst working on classes to speak to local LLMs.

The URLConnection.ContentReceived event only fires when all content from a request is received. If you are receiving streaming content (for instance, server side events - SSE) then URLConnection.ReceivingProgressed will fire as events come in (sometimes partial) and then the entire data payload (which might be thousands of events) will also be provided at the end in the URLConnection.ContentReceived event. The documentation is not clear about this.

3 Likes

The entire data at the end for SSE seems like that can cause issues.