Documentation ¶
Index ¶
Constants ¶
View Source
const ContentModifiedCode = -32801
View Source
const InternalErrorCode = -32603
View Source
const InvalidParamsCode = -32602
View Source
const InvalidRequestCode = -32600
View Source
const MethodNotFoundCode = -32601
View Source
const ParseErrorCode = -32700
View Source
const RequestCancelledCode = -32800
View Source
const ServerNotInitializedCode = -32002
View Source
const UnknownErrorCodeCode = -32001
Variables ¶
View Source
var ContentModified = BuildInError{ Code: ContentModifiedCode, Message: "ContentModified", }
View Source
var InternalError = BuildInError{ Code: InternalErrorCode, Message: "InternalError", }
View Source
var InvalidParams = BuildInError{ Code: InvalidParamsCode, Message: "InvalidParams", }
View Source
var InvalidRequest = BuildInError{ Code: InvalidRequestCode, Message: "InvalidRequest", }
View Source
var MethodNotFound = BuildInError{ Code: MethodNotFoundCode, Message: "MethodNotFound", }
View Source
var ParseError = BuildInError{ Code: ParseErrorCode, Message: "ParseError", }
View Source
var RequestCancelled = BuildInError{ Code: RequestCancelledCode, Message: "RequestCancelled", }
View Source
var ServerNotInitialized = BuildInError{ Code: ServerNotInitializedCode, Message: "ServerNotInitialized", }
View Source
var UnknownErrorCode = BuildInError{ Code: UnknownErrorCodeCode, Message: "UnknownErrorCode", }
Functions ¶
This section is empty.
Types ¶
type BaseMessage ¶
type BaseMessage struct {
Jsonrpc string `json:"jsonrpc"`
}
type BuildInError ¶
type BuildInError = ResponseError
type CancelParams ¶
type CancelParams struct {
ID interface{} `json:"id"` // the method id should be canceled
}
type CloserReader ¶
func NewFakeCloserReader ¶
func NewFakeCloserReader(r io.Reader) CloserReader
type CloserWriter ¶
func NewFakeCloserWriter ¶
func NewFakeCloserWriter(w io.Writer) CloserWriter
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
The connection of rpc, not limited to net.Conn
func NewConn ¶
func NewConn(reader CloserReader, writer CloserWriter) *Conn
type MethodInfo ¶
type MethodInfo struct { Name string NewRequest func() interface{} Handler func(ctx context.Context, req interface{}) (interface{}, error) }
func CancelRequest ¶
func CancelRequest() MethodInfo
type NotificationMessage ¶
type NotificationMessage struct { BaseMessage Method string `json:"method"` // starts with "/$", server build-in methods. Params interface{} `json:"params"` // params, is some struct or slice }
type ProgressParams ¶
type ProgressParams struct { Token interface{} `json:"token"` // int or string /** * The progress data. */ Value interface{} `json:"value"` }
type RequestMessage ¶
type RequestMessage struct { BaseMessage ID interface{} `json:"id"` // may be int or string Method string `json:"method"` Params json.RawMessage `json:"params"` // params, is some struct or slice }
type ResponseError ¶
type ResponseError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
func (ResponseError) Error ¶
func (r ResponseError) Error() string
type ResponseMessage ¶
type ResponseMessage struct { BaseMessage ID interface{} `json:"id"` // may be int or string Result interface{} `json:"result"` Error *ResponseError `json:"error"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ConnComeIn ¶
func (s *Server) ConnComeIn(conn ReaderWriter)
func (*Server) RegisterMethod ¶
func (s *Server) RegisterMethod(m MethodInfo)
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func GetSession ¶ added in v0.0.7
func (*Session) SendNotification ¶ added in v0.0.7
func (s *Session) SendNotification(msg NotificationMessage)
Click to show internal directories.
Click to hide internal directories.