Documentation
¶
Index ¶
- Variables
- func RegisterHandler(payloadType string, handler HandlerFunc) error
- type HandlerFunc
- type HandlerFuncWithRawRequest
- type HandlerRegistrar
- type HandlerRegistry
- func (r *HandlerRegistry) GetHandler(payloadType string) (HandlerFunc, bool)
- func (r *HandlerRegistry) GetRegisteredTypes() []string
- func (r *HandlerRegistry) HandleRequest(c backends.Context, recoveredID string, payloadType string, jsonString string) bool
- func (r *HandlerRegistry) HandleRequestWithRaw(c backends.Context, recoveredID string, payloadType string, jsonString string, ...) bool
- func (r *HandlerRegistry) Register(payloadType string, handler HandlerFunc) error
- func (r *HandlerRegistry) RegisterWithRawRequest(payloadType string, handler HandlerFuncWithRawRequest) error
Constants ¶
This section is empty.
Variables ¶
var GlobalRegistry = NewHandlerRegistry()
GlobalRegistry is the global handler registry instance
Functions ¶
func RegisterHandler ¶
func RegisterHandler(payloadType string, handler HandlerFunc) error
RegisterHandler is a convenience function to register handlers globally
Types ¶
type HandlerFunc ¶
type HandlerFunc func(c backends.Context, recoveredID string, payloadType string, jsonString string)
HandlerFunc defines the signature for request handlers
type HandlerFuncWithRawRequest ¶
type HandlerFuncWithRawRequest func(c backends.Context, recoveredID string, payloadType string, jsonString string, rawRequest string)
HandlerFuncWithRawRequest defines the signature for request handlers that need access to the raw request
type HandlerRegistrar ¶
type HandlerRegistrar interface {
RegisterHandlers(registry *HandlerRegistry) error
}
HandlerRegistrar defines the interface for handlers that can register themselves
type HandlerRegistry ¶
type HandlerRegistry struct {
// contains filtered or unexported fields
}
HandlerRegistry manages the registration of all RPC handlers
func NewHandlerRegistry ¶
func NewHandlerRegistry() *HandlerRegistry
NewHandlerRegistry creates a new handler registry
func (*HandlerRegistry) GetHandler ¶
func (r *HandlerRegistry) GetHandler(payloadType string) (HandlerFunc, bool)
GetHandler retrieves a handler for a specific payload type
func (*HandlerRegistry) GetRegisteredTypes ¶
func (r *HandlerRegistry) GetRegisteredTypes() []string
GetRegisteredTypes returns all registered payload types
func (*HandlerRegistry) HandleRequest ¶
func (r *HandlerRegistry) HandleRequest(c backends.Context, recoveredID string, payloadType string, jsonString string) bool
HandleRequest handles an RPC request by looking up the appropriate handler
func (*HandlerRegistry) HandleRequestWithRaw ¶
func (r *HandlerRegistry) HandleRequestWithRaw(c backends.Context, recoveredID string, payloadType string, jsonString string, rawRequest string) bool
HandleRequestWithRaw handles an RPC request that may need access to raw request data
func (*HandlerRegistry) Register ¶
func (r *HandlerRegistry) Register(payloadType string, handler HandlerFunc) error
Register registers a handler function for a specific payload type
func (*HandlerRegistry) RegisterWithRawRequest ¶
func (r *HandlerRegistry) RegisterWithRawRequest(payloadType string, handler HandlerFuncWithRawRequest) error
RegisterWithRawRequest registers a handler function that needs access to the raw request