good morning!!!!

Skip to content
Snippets Groups Projects
jrpc.go 480 B
Newer Older
a's avatar
rpc
a committed
package jrpc

import (
a's avatar
a committed
	"net/http"
a's avatar
rpc
a committed
)

a's avatar
a committed
// http.handler, but for jrpc
type Handler interface {
	ServeRPC(w ResponseWriter, r *Request)
}

// http.HandlerFunc,but for jrpc
type HandlerFunc func(w ResponseWriter, r *Request)

func (fn HandlerFunc) ServeRPC(w ResponseWriter, r *Request) {
	(fn)(w, r)
}

// http.ResponseWriter interface, but for jrpc
type ResponseWriter interface {
	Send(v any, err error) error
	Option(k string, v any)
	Header() http.Header

	Notify(v any) error
}