Documentation ¶
Index ¶
- func DefaultMessageValidator(msg *messages.GlideMessage) (error, *messages.GlideMessage)
- type ActionHandler
- type ActionWithReplyHandler
- type HandlerFunc
- type Interface
- type MessageHandler
- type MessageInterfaceImpl
- func (d *MessageInterfaceImpl) AddHandler(i MessageHandler)
- func (d *MessageInterfaceImpl) GetClientInterface() gate.Gateway
- func (d *MessageInterfaceImpl) GetGroupInterface() subscription.Interface
- func (d *MessageInterfaceImpl) Handle(cInfo *gate.Info, msg *messages.GlideMessage) error
- func (d *MessageInterfaceImpl) OnHandleMessageError(cInfo *gate.Info, msg *messages.GlideMessage, err error)
- func (d *MessageInterfaceImpl) SetGate(g gate.Gateway)
- func (d *MessageInterfaceImpl) SetNotifyErrorOnServer(enable bool)
- func (d *MessageInterfaceImpl) SetSubscription(g subscription.Interface)
- type MessageValidationHandler
- type MessageValidator
- type Messaging
- type ReplyHandlerFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultMessageValidator ¶ added in v1.3.4
func DefaultMessageValidator(msg *messages.GlideMessage) (error, *messages.GlideMessage)
Types ¶
type ActionHandler ¶ added in v1.2.1
type ActionHandler struct {
// contains filtered or unexported fields
}
ActionHandler is a handler for a specific message action.
func NewActionHandler ¶ added in v1.2.1
func NewActionHandler(action messages.Action, fn HandlerFunc) *ActionHandler
func (*ActionHandler) Handle ¶ added in v1.2.1
func (a *ActionHandler) Handle(h *MessageInterfaceImpl, cliInfo *gate.Info, message *messages.GlideMessage) bool
type ActionWithReplyHandler ¶ added in v1.2.1
type ActionWithReplyHandler struct {
// contains filtered or unexported fields
}
ActionWithReplyHandler is a handler for a specific message action, this handler will return a reply message.
func NewActionWithReplyHandler ¶ added in v1.2.1
func NewActionWithReplyHandler(action messages.Action, fn ReplyHandlerFunc) *ActionWithReplyHandler
func (*ActionWithReplyHandler) Handle ¶ added in v1.2.1
func (rh *ActionWithReplyHandler) Handle(h *MessageInterfaceImpl, cInfo *gate.Info, msg *messages.GlideMessage) bool
type HandlerFunc ¶
type HandlerFunc func(cliInfo *gate.Info, message *messages.GlideMessage) error
HandlerFunc is used to handle message with specified action in ActionHandler
type Interface ¶
type Interface interface { // Handle handles message from gate, the entry point for the messaging. Handle(clientInfo *gate.Info, msg *messages.GlideMessage) error AddHandler(i MessageHandler) }
Interface for messaging.
type MessageHandler ¶ added in v1.2.1
type MessageHandler interface { // Handle handles the message, returns true if the message is handled, // otherwise the message is delegated to next handler. Handle(h *MessageInterfaceImpl, cliInfo *gate.Info, message *messages.GlideMessage) bool }
MessageHandler is the interface for message handler
type MessageInterfaceImpl ¶ added in v1.2.1
type MessageInterfaceImpl struct {
// contains filtered or unexported fields
}
MessageInterfaceImpl default implementation of the messaging interface.
func NewDefaultImpl ¶
func NewDefaultImpl(store store.MessageStore) (*MessageInterfaceImpl, error)
func (*MessageInterfaceImpl) AddHandler ¶ added in v1.2.1
func (d *MessageInterfaceImpl) AddHandler(i MessageHandler)
func (*MessageInterfaceImpl) GetClientInterface ¶ added in v1.2.1
func (d *MessageInterfaceImpl) GetClientInterface() gate.Gateway
func (*MessageInterfaceImpl) GetGroupInterface ¶ added in v1.2.1
func (d *MessageInterfaceImpl) GetGroupInterface() subscription.Interface
func (*MessageInterfaceImpl) Handle ¶ added in v1.2.1
func (d *MessageInterfaceImpl) Handle(cInfo *gate.Info, msg *messages.GlideMessage) error
func (*MessageInterfaceImpl) OnHandleMessageError ¶ added in v1.2.1
func (d *MessageInterfaceImpl) OnHandleMessageError(cInfo *gate.Info, msg *messages.GlideMessage, err error)
func (*MessageInterfaceImpl) SetGate ¶ added in v1.2.1
func (d *MessageInterfaceImpl) SetGate(g gate.Gateway)
func (*MessageInterfaceImpl) SetNotifyErrorOnServer ¶ added in v1.3.2
func (d *MessageInterfaceImpl) SetNotifyErrorOnServer(enable bool)
func (*MessageInterfaceImpl) SetSubscription ¶ added in v1.2.1
func (d *MessageInterfaceImpl) SetSubscription(g subscription.Interface)
type MessageValidationHandler ¶ added in v1.3.4
type MessageValidationHandler struct {
// contains filtered or unexported fields
}
MessageValidationHandler validates message before handling
func NewMessageValidationHandler ¶ added in v1.3.4
func NewMessageValidationHandler(validators ...MessageValidator) *MessageValidationHandler
func (*MessageValidationHandler) Handle ¶ added in v1.3.4
func (m *MessageValidationHandler) Handle(h *MessageInterfaceImpl, cliInfo *gate.Info, message *messages.GlideMessage) bool
type MessageValidator ¶ added in v1.3.4
type MessageValidator = func(msg *messages.GlideMessage) (error, *messages.GlideMessage)
MessageValidator is used to validate message. if error is not nil, this message will be handled by MessageValidationHandler the second return value is the reply message, if not nil, the message will be sent to the client, if nil, the MessageValidationHandler will return the error message
type Messaging ¶
type Messaging interface { Interface SetSubscription(g subscription.Interface) SetGate(g gate.Gateway) }
type ReplyHandlerFunc ¶ added in v1.2.1
type ReplyHandlerFunc func(cliInfo *gate.Info, message *messages.GlideMessage) (*messages.GlideMessage, error)