Documentation ¶
Overview ¶
Package rpc contains defines for rpc server and client.
Package rpc contains defines for rpc server and client.
Index ¶
Constants ¶
View Source
const ( JsonrpcVersion = "2.0" ServiceMethodSeparator = "_" ContentType = "application/json" )
View Source
const ( RPCPath = "/rpc" WebSocketPath = "/ws" SubscribeMethodSuffix = "_subscribe" UnsubscribeMethodSuffix = "_unsubscribe" NotificationMethodSuffix = "_subscription" )
Variables ¶
View Source
var ( // ErrNotificationsUnsupported is returned when the connection doesn't support notifications ErrNotificationsUnsupported = errors.New("notifications not supported") // ErrNotificationNotFound is returned when the notification for the given id is not found ErrSubscriptionNotFound = errors.New("subscription not found") )
Functions ¶
This section is empty.
Types ¶
type JsonErrResponse ¶
type JsonError ¶
type JsonNotification ¶
type JsonNotification struct { Version string `json:"jsonrpc"` Method string `json:"method"` Params JsonSubscription `json:"params"` }
type JsonRequest ¶
type JsonRequest struct { Method string `json:"method"` Version string `json:"jsonrpc"` Id json.RawMessage `json:"id,omitempty"` Payload json.RawMessage `json:"params,omitempty"` }
type JsonSubscription ¶
type JsonSubscription struct { Subscription string `json:"subscription"` Result interface{} `json:"result,omitempty"` }
type JsonSuccessResponse ¶
type JsonSuccessResponse struct { Version string `json:"jsonrpc"` Id interface{} `json:"id,omitempty"` Result interface{} `json:"result"` }
Click to show internal directories.
Click to hide internal directories.