We're doing a weird trick with Nostr+HTTP in Ditto, which follows these steps:
1. Client hits the API, eg POST /api/v1/statuses
2. Ditto sends a WebSocket message to the client, asking it to sign the Nostr event.
3. The client signs the Nostr event, using NIP-07, a stored key, or whatever other method it wants to use, then sends it back over the WebSocket.
4. All this time, the HTTP request from step 1 still hasn't received a response. But now that the backend (Ditto) is finished, it delivers the response.
Here is the problem: sometimes that takes more than 60 seconds. It's no issue for Deno, which is very efficient at dealing with idle HTTP connections, but most webservers such as Nginx and anything on top, will cut the request off at 60 seconds.
60 seconds is a reasonable amount of time to wait for a user to sign an event. But now I'm introducing proof-of-work requirements, some of which are designed to not finish in less than 60 seconds on purpose.
So now I need to rethink this. I originally chose this design because Mastodon clients already rely on the HTTP response to show toasts such as "Post successfully submitted! [View]" and "Internal Server Error". By keeping the connection open, we can submit the correct response code when it's ready, avoiding a broken UX.
So the question is how to extend the duration of the request. Or how to prepare the information needed before making the request.
I know this sounds insane, but it will be so worth it.
Between the `kind`, `content`, and `tags`, you can implement any data structure imaginable on Nostr. If you want an "Audio" type, just use a custom Kind, and put your data as a JSON string in `content`. Nostr is a transport format for dealing with relays and keys. You can still structure the data however you want.