Return HTTP error status code in SSE OnConnect

Trying to work out how to return an error status code when an event stream is connected to via SSE.

I’ve found a post talking about returning in OnHeartbeatInit, but not for other hooks.

The other custom event hooks are listed in the docs at Custom Event Hooks and Order of Events.

E.g. You can use OnCreated to inspect the subscription then close the response with a HTTP Response Error, the same as you would do within a filter.

Thanks for the information.

However, I don’t have access to the response object from the OnCreated function, only OnPublish has the response accessible?

It’s accessible from IRequest.Response.


Just wanted to say a huge thanks for all of your help and for such a fantastic product. It’s worth every penny!

1 Like