Documentation ¶
Index ¶
- Constants
- func Handler(fn func(*Connection)) http.Handler
- func ThrowError(msg string)
- func ThrowWarning(msg string)
- func TryRecoverFromPanic(conn *Connection)
- func WrapFunctionForPanicRecover(fn func(), conn *Connection) func()
- type Agenter
- type Commander
- type Connection
- func (c *Connection) Close()
- func (c *Connection) Closed() bool
- func (c *Connection) RegisterAgent(agent Agenter)
- func (c *Connection) Send(event Notification)
- func (c *Connection) SendErrorResult(id int64, targetId string, errorCode ResponseErrorCodes, message string)
- func (c *Connection) SendResult(id int64, targetId string, result interface{})
- func (c *Connection) SendToTarget(targetId string, event interface{})
- func (c *Connection) SetupCommand(id int64, targetId string, data *json.RawMessage, out Commander)
- type Error
- type Notification
- type ReceivedCommand
- type Response
- type ResponseError
- type ResponseErrorCodes
- type ResponseStatusCodes
- type Warning
Constants ¶
View Source
const ( ErrorCodeParseError = ResponseErrorCodes(-32700) ErrorCodeInvalidRequest = ResponseErrorCodes(-32600) ErrorCodeMethodNotFound = ResponseErrorCodes(-32601) ErrorCodeInvalidParams = ResponseErrorCodes(-32602) ErrorCodeInternalError = ResponseErrorCodes(-32603) ErrorCodeServerError = ResponseErrorCodes(-32000) )
View Source
const ( StatusCodeSuccess = ResponseStatusCodes(0) StatusCodeError = ResponseStatusCodes(1) StatusCodeFallThrough = ResponseStatusCodes(2) StatusCodeAsync = ResponseStatusCodes(3) )
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(fn func(*Connection)) http.Handler
func ThrowError ¶
func ThrowError(msg string)
func ThrowWarning ¶
func ThrowWarning(msg string)
func TryRecoverFromPanic ¶
func TryRecoverFromPanic(conn *Connection)
func WrapFunctionForPanicRecover ¶
func WrapFunctionForPanicRecover(fn func(), conn *Connection) func()
Types ¶
type Commander ¶
type Commander interface {
Initalize(targetId string, responseId int64, conn *Connection)
}
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) Closed ¶
func (c *Connection) Closed() bool
func (*Connection) RegisterAgent ¶
func (c *Connection) RegisterAgent(agent Agenter)
func (*Connection) Send ¶
func (c *Connection) Send(event Notification)
func (*Connection) SendErrorResult ¶
func (c *Connection) SendErrorResult(id int64, targetId string, errorCode ResponseErrorCodes, message string)
func (*Connection) SendResult ¶
func (c *Connection) SendResult(id int64, targetId string, result interface{})
func (*Connection) SendToTarget ¶
func (c *Connection) SendToTarget(targetId string, event interface{})
func (*Connection) SetupCommand ¶
func (c *Connection) SetupCommand(id int64, targetId string, data *json.RawMessage, out Commander)
type Notification ¶
type Notification struct { Method string `json:"method"` Params interface{} `json:"params,omitempty"` }
type ReceivedCommand ¶
type ReceivedCommand struct { Id int64 `json:"id"` Method string `json:"method"` Params *json.RawMessage `json:"params,omitempty"` }
type Response ¶
type Response struct { Id int64 `json:"id"` Result interface{} `json:"result"` Status ResponseStatusCodes `json:"status,omitempty"` Error *ResponseError `json:"error,omitempty"` }
type ResponseError ¶
type ResponseError struct { Code ResponseErrorCodes `json:"code"` Message string `json:"message"` }
type ResponseErrorCodes ¶
type ResponseErrorCodes int64
type ResponseStatusCodes ¶
type ResponseStatusCodes int64
Click to show internal directories.
Click to hide internal directories.