Documentation ¶
Index ¶
- Constants
- func ReadMessage(m *Message, rd io.Reader) (err error)
- func WriteMessage(m *Message, w io.Writer) (err error)
- type Conn
- type ConnErrHandler
- type ConnHandler
- type ConnectOption
- func WithAllowReconnect() ConnectOption
- func WithAuth(username string, secret string) ConnectOption
- func WithContext(ctx context.Context) ConnectOption
- func WithCustomDialer(dialer CustomDialer) ConnectOption
- func WithOnConnectError(handler ConnErrHandler) ConnectOption
- func WithOnConnected(handler ConnHandler) ConnectOption
- func WithSubscribe(cb SubscribeFunc, opts ...SubscribeOption) ConnectOption
- func WithTimeout(timeout time.Duration) ConnectOption
- type ConnectOptions
- type CustomDialer
- type Message
- func (m *Message) AttrString(name string) string
- func (m *Message) Error() error
- func (m *Message) Format() string
- func (m *Message) Message() string
- func (m *Message) Read(r *bufio.Reader) (err error)
- func (m *Message) SetAttr(name string, val interface{})
- func (m *Message) Success() bool
- func (m *Message) Write(w io.Writer) (err error)
- type MessageType
- type RequestOption
- type SubscribeFunc
- type SubscribeOption
Constants ¶
View Source
const ( MessageTypeAction MessageType = "Action" MessageTypeEvent = "Event" MessageTypeResponse = "Response" )
View Source
const ( EOL = "\r\n" EOM = "\r\n\r\n" EOB = '\n' SEP = ":" SPC = " " EMP = "" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) Request ¶
func (c *Conn) Request(r interface{}, opts ...RequestOption) (resp *Message, err error)
func (*Conn) Subscribe ¶
func (c *Conn) Subscribe(cb SubscribeFunc, opts ...SubscribeOption) (func(), error)
type ConnErrHandler ¶
type ConnHandler ¶
type ConnHandler func(*Conn)
type ConnectOption ¶
type ConnectOption func(c *ConnectOptions) error
func WithAllowReconnect ¶
func WithAllowReconnect() ConnectOption
func WithAuth ¶
func WithAuth(username string, secret string) ConnectOption
func WithContext ¶
func WithContext(ctx context.Context) ConnectOption
func WithCustomDialer ¶
func WithCustomDialer(dialer CustomDialer) ConnectOption
func WithOnConnectError ¶
func WithOnConnectError(handler ConnErrHandler) ConnectOption
func WithOnConnected ¶
func WithOnConnected(handler ConnHandler) ConnectOption
func WithSubscribe ¶
func WithSubscribe(cb SubscribeFunc, opts ...SubscribeOption) ConnectOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ConnectOption
type ConnectOptions ¶
type ConnectOptions struct { Context context.Context Timeout time.Duration AllowReconnect bool Username string // login username Secret string // login secret Logger *zap.Logger Dialer CustomDialer OnConnectErr ConnErrHandler OnConnected ConnHandler // contains filtered or unexported fields }
type Message ¶
type Message struct { Type MessageType Name string Attributes map[string]interface{} }
func ConvertToMessage ¶
func (*Message) AttrString ¶
type MessageType ¶
type MessageType string
type RequestOption ¶
type RequestOption func(o *requestOptions) error
func RequestResponseCallback ¶
func RequestResponseCallback(cb func(ctx context.Context, msg *Message, err error)) RequestOption
func RequestTimeout ¶
func RequestTimeout(d time.Duration) RequestOption
type SubscribeFunc ¶
func SubscribeChan ¶
func SubscribeChan(c chan *Message, names ...string) SubscribeFunc
func SubscribeFullyBootedChanOnce ¶
func SubscribeFullyBootedChanOnce(c chan *Message) SubscribeFunc
type SubscribeOption ¶
type SubscribeOption func(o *subscribe) error
func SubscribeSend ¶
func SubscribeSend() SubscribeOption
func SubscribeSetContext ¶
func SubscribeSetContext(ctx context.Context) SubscribeOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.