Versions in this module Expand all Collapse all v1 v1.1.1 Sep 13, 2019 Changes in this version type Response + Extensions map[string]interface{} v1.1.0 Sep 13, 2019 Changes in this version type Options + HideErrorDataField bool type Server + func (s Server) Do(ctx context.Context, req []byte) ([]byte, error) v1.0.1 Dec 27, 2017 Changes in this version + const IDKey + func IDFromContext(ctx context.Context) *json.RawMessage v1.0.0 Nov 17, 2017 Changes in this version + const InternalError + const InvalidParams + const InvalidRequest + const MethodNotFound + const ParseError + const ServerError + const Version + func ConvertToObject(keys []string, params json.RawMessage) (json.RawMessage, error) + func ErrorMsg(code int) string + func IsArray(message json.RawMessage) bool + func NamespaceFromContext(ctx context.Context) string + func RequestFromContext(ctx context.Context) (*http.Request, bool) + func SMDBoxHandler(w http.ResponseWriter, r *http.Request) + type Error struct + Code int + Data interface{} + Err error + Message string + func NewError(code int, err error) *Error + func NewStringError(code int, message string) *Error + func (e Error) Error() string + type InvokeFunc func(context.Context, string, json.RawMessage) Response + type Invoker interface + Invoke func(ctx context.Context, method string, params json.RawMessage) Response + SMD func() smd.ServiceInfo + type MiddlewareFunc func(InvokeFunc) InvokeFunc + func Logger(l *log.Logger) MiddlewareFunc + func Metrics(appName string) MiddlewareFunc + type Options struct + AllowCORS bool + BatchMaxLen int + DisableTransportChecks bool + ExposeSMD bool + TargetURL string + Upgrader *websocket.Upgrader + type Printer interface + Printf func(string, ...interface{}) + type Request struct + ID *json.RawMessage + Method string + Namespace string + Params json.RawMessage + Version string + type Response struct + Error *Error + ID *json.RawMessage + Result *json.RawMessage + Version string + func NewResponseError(id *json.RawMessage, code int, message string, data interface{}) Response + func (r *Response) Set(v interface{}, er ...error) + func (r Response) JSON() []byte + type Server struct + func NewServer(opts Options) Server + func (s *Server) Register(namespace string, service Invoker) + func (s *Server) RegisterAll(services map[string]Invoker) + func (s *Server) SetLogger(printer Printer) + func (s *Server) Use(m ...MiddlewareFunc) + func (s Server) SMD() smd.Schema + func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s Server) ServeWS(w http.ResponseWriter, r *http.Request) + type Service struct