Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type ClientConfig
- type ClientError
- type ClientOption
- type Endpoint
- type EndpointResp
- type Frame
- func (*Frame) Descriptor() ([]byte, []int)
- func (m *Frame) GetHeaders() []Header
- func (m *Frame) GetLogID() uint64
- func (m *Frame) GetLogIDNew() string
- func (m *Frame) GetMethod() int32
- func (m *Frame) GetPayload() []byte
- func (m *Frame) GetPayloadEncoding() string
- func (m *Frame) GetPayloadType() string
- func (m *Frame) GetSeqID() uint64
- func (m *Frame) GetService() int32
- func (m *Frame) Marshal() (dAtA []byte, err error)
- func (m *Frame) MarshalTo(dAtA []byte) (int, error)
- func (m *Frame) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Frame) ProtoMessage()
- func (m *Frame) Reset()
- func (m *Frame) Size() (n int)
- func (m *Frame) String() string
- func (m *Frame) Unmarshal(dAtA []byte) error
- func (m *Frame) XXX_DiscardUnknown()
- func (m *Frame) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Frame) XXX_Merge(src proto.Message)
- func (m *Frame) XXX_Size() int
- func (m *Frame) XXX_Unmarshal(b []byte) error
- type FrameType
- type Header
- func (*Header) Descriptor() ([]byte, []int)
- func (m *Header) GetKey() string
- func (m *Header) GetValue() string
- func (m *Header) Marshal() (dAtA []byte, err error)
- func (m *Header) MarshalTo(dAtA []byte) (int, error)
- func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Header) ProtoMessage()
- func (m *Header) Reset()
- func (m *Header) Size() (n int)
- func (m *Header) String() string
- func (m *Header) Unmarshal(dAtA []byte) error
- func (m *Header) XXX_DiscardUnknown()
- func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Header) XXX_Merge(src proto.Message)
- func (m *Header) XXX_Size() int
- func (m *Header) XXX_Unmarshal(b []byte) error
- type Headers
- type MessageType
- type Response
- type ServerError
Constants ¶
View Source
const ( GenEndpointUri = "/callback/ws/endpoint" DeviceID = "device_id" ServiceID = "service_id" )
View Source
const ( HeaderTimestamp = "timestamp" // 消息时间戳, 单位ms HeaderType = "type" // 消息类型, Event/Card HeaderMessageID = "message_id" // 消息ID, 拆包后继承 HeaderSum = "sum" // 拆包数, 未拆包为1 HeaderSeq = "seq" // 包序号, 未拆包为0 HeaderTraceID = "trace_id" // 链路ID HeaderInstanceID = "instance_id" // 标识下行消息来源及上行消息去向的机器实例地址, 由 ip、port、pod_name 等信息加密获得 HeaderBizRt = "biz_rt" // 业务处理时长,单位ms HeaderHandshakeStatus = "Handshake-Status" HeaderHandshakeMsg = "Handshake-Msg" HeaderHandshakeAuthErrCode = "Handshake-Autherrcode" )
View Source
const ( OK = 0 SystemBusy = 1 Forbidden = 403 AuthFailed = 514 ExceedConnLimit = 1000040350 InternalError = 1000040343 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(appId, appSecret string, opts ...ClientOption) *Client
type ClientConfig ¶
type ClientConfig struct { ReconnectCount int `json:"ReconnectCount,omitempty"` ReconnectInterval int `json:"ReconnectInterval,omitempty"` ReconnectNonce int `json:"ReconnectNonce,omitempty"` PingInterval int `json:"PingInterval,omitempty"` }
ClientConfig 由服务端下发
type ClientError ¶
func NewClientError ¶
func NewClientError(code int, msg string) *ClientError
func (*ClientError) Error ¶
func (e *ClientError) Error() string
type ClientOption ¶
type ClientOption func(cli *Client)
func WithAutoReconnect ¶
func WithAutoReconnect(b bool) ClientOption
func WithDomain ¶
func WithDomain(domain string) ClientOption
func WithEventHandler ¶
func WithEventHandler(handler *dispatcher.EventDispatcher) ClientOption
func WithLogLevel ¶
func WithLogLevel(level larkcore.LogLevel) ClientOption
func WithLogger ¶
func WithLogger(logger larkcore.Logger) ClientOption
type Endpoint ¶
type Endpoint struct { Url string `json:"URL,omitempty"` ClientConfig *ClientConfig `json:"ClientConfig,omitempty"` }
type EndpointResp ¶
type Frame ¶
type Frame struct { SeqID uint64 `protobuf:"varint,1,req,name=SeqID" json:"SeqID"` LogID uint64 `protobuf:"varint,2,req,name=LogID" json:"LogID"` Service int32 `protobuf:"varint,3,req,name=service" json:"service"` Method int32 `protobuf:"varint,4,req,name=method" json:"method"` Headers []Header `protobuf:"bytes,5,rep,name=headers" json:"headers"` PayloadEncoding string `protobuf:"bytes,6,opt,name=payload_encoding" json:"payload_encoding"` PayloadType string `protobuf:"bytes,7,opt,name=payload_type" json:"payload_type"` Payload []byte `protobuf:"bytes,8,opt,name=payload" json:"payload"` LogIDNew string `protobuf:"bytes,9,opt,name=LogIDNew" json:"LogIDNew"` }
message frame
func NewPingFrame ¶
func (*Frame) Descriptor ¶
func (*Frame) GetHeaders ¶
func (*Frame) GetLogIDNew ¶
func (*Frame) GetPayload ¶
func (*Frame) GetPayloadEncoding ¶
func (*Frame) GetPayloadType ¶
func (*Frame) GetService ¶
func (*Frame) ProtoMessage ¶
func (*Frame) ProtoMessage()
func (*Frame) XXX_DiscardUnknown ¶
func (m *Frame) XXX_DiscardUnknown()
func (*Frame) XXX_Marshal ¶
func (*Frame) XXX_Unmarshal ¶
type Header ¶
type Header struct { Key string `protobuf:"bytes,1,req,name=key" json:"key"` Value string `protobuf:"bytes,2,req,name=value" json:"value"` }
func (*Header) Descriptor ¶
func (*Header) MarshalToSizedBuffer ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
func (*Header) XXX_DiscardUnknown ¶
func (m *Header) XXX_DiscardUnknown()
func (*Header) XXX_Marshal ¶
func (*Header) XXX_Unmarshal ¶
type MessageType ¶
type MessageType string
const ( MessageTypeEvent MessageType = "event" MessageTypeCard MessageType = "card" MessageTypePing MessageType = "ping" MessageTypePong MessageType = "pong" )
type Response ¶
type Response struct { StatusCode int `json:"code"` Headers map[string]string `json:"headers"` Data []byte `json:"data"` }
Response 上行响应消息结构, 置于 Frame.Payload
func NewResponseByCode ¶
type ServerError ¶
func NewServerError ¶
func NewServerError(code int, msg string) *ServerError
func (*ServerError) Error ¶
func (e *ServerError) Error() string
Click to show internal directories.
Click to hide internal directories.