Phoenix, mix of HTTP and manual websockets on same endpoint

I am making a FOSS nostr relay with Phoenix, which pretty much only consists of a websocket endpoint, as seen here. I want to be clear about the fact that this has nothing to do with Phoenix Channels, it’s plain websockets.

Works very well, except for one detail… The relay should be able to document itself through the same address when it gets a header of application/nostr+json as described here in the spec.

I must admit I am not the most knowledgeable guy on phoenix endpoints. I so far failed to find a way to get there…

A similar but different problem involves sending the request to the router so it can be treated as a web page whenever it turns out not being a websocket client at the same exact address.

Is this all possible with Phoenix?