Documentation
¶
Index ¶
- Variables
- func CreatePushSocket(url string) (mangos.Socket, error)
- func CreateResponseWRP(msg *wrp.Message) *wrp.Message
- func ParseBus(wrpBusOut chan wrp.Message, dataBusIn chan []byte, stopReading chan struct{}, ...)
- func ReadPump(pullSock mangos.Socket, msgBus chan []byte, logger log.Logger)
- func SendMessage(sock mangos.Socket, msg wrp.Message) error
- func SetupFlagSet(fs *pflag.FlagSet) error
- func WritePump(pushSock mangos.Socket, bus chan wrp.Message, stopWriting chan struct{}, ...)
- type AllowMessage
- type AllowMessageFunc
- type ClientConfig
- type SendMessageHandler
- type SendMessageHandlerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidPartnerID = errors.New("partner id does not match")
)
Functions ¶
func CreatePushSocket ¶
func CreateResponseWRP ¶
func CreateResponseWRP(msg *wrp.Message) *wrp.Message
func SendMessage ¶
func SendMessage(sock mangos.Socket, msg wrp.Message) error
SendMessage will encode the message as msgpack and send the message. Note this is async. I couldn't find a way to make this synchronous.
func SetupFlagSet ¶
SetupFlagSet sets up some initial helper flags
Types ¶
type AllowMessage ¶
type AllowMessage interface {
Allow(msg wrp.Message) error
}
AllowMessage is the interface to block request that come from talaria. If an error is returned, an unauthorized message will be sent with the error payload
type AllowMessageFunc ¶
type AllowMessageFunc func(msg wrp.Message) error
AllowMessageFunc is the Allow function that a AllowMessage has.
func BlockByPartnerID ¶
func BlockByPartnerID(partnerID string) AllowMessageFunc
BlockByPartnerID is a AllowMessageFunc to block request that don't have the associated device partnerID with the wrp request.
func (AllowMessageFunc) Allow ¶
func (allowFunc AllowMessageFunc) Allow(msg wrp.Message) error
Allow runs the allowMessageFunc, making an AllowMessageFunc also an AllowMessage.
type ClientConfig ¶
type SendMessageHandler ¶
func StartClient ¶
func StartClient(config ClientConfig, lc fx.Lifecycle) (SendMessageHandler, error)
type SendMessageHandlerFunc ¶
func (SendMessageHandlerFunc) SendMessage ¶
func (sendMessageHandlerFunc SendMessageHandlerFunc) SendMessage(msg wrp.Message, c context.Context) error
Click to show internal directories.
Click to hide internal directories.