Documentation
¶
Index ¶
- Constants
- func BroadcastEvent(ctx context.Context, eventName string, data any, conns ...*websocket.Conn) (<-chan SendResult, error)
- func EmitEvent(ctx context.Context, eventName string, data any, conn *websocket.Conn) error
- func Register[Params any, Result any](s *Server, method string, fn func(context.Context, *Params) (Result, error))
- type Error
- type Event
- type Request
- type Response
- type SendResult
- type Server
Constants ¶
View Source
const ( CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternalError = -32603 CodeUnimplementedError = -32604 )
View Source
const JSONRPCVer = "2.0"
Variables ¶
This section is empty.
Functions ¶
func BroadcastEvent ¶ added in v0.1.2
Types ¶
type Error ¶
type Request ¶
type Request struct { JSONRPC string `json:"jsonrpc"` ID json.RawMessage `json:"id,omitempty"` Method string `json:"method"` Params json.RawMessage `json:"params,omitempty"` }
type Response ¶
type Response struct { JSONRPC string `json:"jsonrpc"` ID json.RawMessage `json:"id"` Result any `json:"result,omitempty"` Error *Error `json:"error,omitempty"` }
type SendResult ¶ added in v0.1.2
Click to show internal directories.
Click to hide internal directories.