type Handler … type Replier … // MethodNotFound is a Handler that replies to all call requests with the // standard method not found response. // This should normally be the final handler in a chain. func MethodNotFound(ctx context.Context, reply Replier, req Request) error { … } // MustReplyHandler is a middleware that creates a Handler that panics if the // wrapped handler does not call Reply for every request that it is passed. func MustReplyHandler(handler Handler) Handler { … } // CancelHandler returns a handler that supports cancellation, and a function // that can be used to trigger canceling in progress requests. func CancelHandler(handler Handler) (Handler, func(id ID)) { … } // AsyncHandler is a middleware that returns a handler that processes each // request goes in its own goroutine. // The handler returns immediately, without the request being processed. // Each request then waits for the previous request to finish before it starts. // This allows the stream to unblock at the cost of unbounded goroutines // all stalled on the previous one. func AsyncHandler(handler Handler) Handler { … } // Async, when used with the [AsyncHandler] middleware, indicates that the // current jsonrpc2 request may be handled asynchronously to subsequent // requests. // // When not used with an AsyncHandler, Async is a no-op. // // Async must be called at most once on each request's context (and its // descendants). func Async(ctx context.Context) { … } type asyncKeyType … var asyncKey … type releaser … // release closes the associated channel. If soft is set, multiple calls to // release are allowed. func (r *releaser) release(soft bool) { … }