Documentation ¶
Index ¶
- Constants
- type ActionType
- type Config
- type ErrorHandler
- type GetBotUnreadMessagesParams
- type GetConversationMessagesParams
- type ResourceType
- type SendImageMessageParams
- type SendMessage
- type SendTextMessageParams
- type Server
- func (server *Server) BotAndWsConnectionsSubKey(botId string, resourceType int32) string
- func (server *Server) CreateWsConnection(wsConnection *websocket.Conn, token string, user *utils.AuthUser) *WsConnection
- func (server *Server) GetSubscribedConnections(botId string, resourceType int32) []*WsConnection
- func (server *Server) NewHubGRPCWrapper() (*rpc.GRPCWrapper, error)
- func (server *Server) NewWebGRPCWrapper() (*rpc.GRPCWrapper, error)
- func (server *Server) RecoverConnectionSubs()
- func (server *Server) RemoveSubsForConnection(wsConnection *WsConnection) error
- func (server *Server) Serve() error
- func (server *Server) ServeWebsocketServer() error
- func (server *Server) StartHubClient()
- func (server *Server) UpdateConnectionSubs(wsConnection *WsConnection, resources []*pb.StreamingResource) error
- type WsConnection
- func (wsConnection *WsConnection) Close() error
- func (wsConnection *WsConnection) CreateRequest(eventType string, payload interface{}) *WsEvent
- func (wsConnection *WsConnection) On(eventName string, eventHandler WsEventEventHandlerFunc)
- func (wsConnection *WsConnection) Send(event *WsEvent)
- func (wsConnection *WsConnection) SendHubBotAction(botLogin string, actionType string, actionBody string) (*httpx.RestfulResponse, error)
- func (wsConnection *WsConnection) SendWithAck(event *WsEvent, ack WsEventAckFunc)
- type WsEvent
- type WsEventAckFunc
- type WsEventAckWrapper
- type WsEventError
- type WsEventEventHandlerFunc
Constants ¶
View Source
const ( Subscribe ActionType = 1 UnSubscribe ActionType = 2 Message ResourceType = 1 Moment ResourceType = 2 )
View Source
const SEP = "[:bot-ws-sub-key:]"
SEP 起名字特殊一点,防止 botId 包含 SEP
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType int32
type ErrorHandler ¶
type ErrorHandler struct {
domains.ErrorHandler
}
type ResourceType ¶
type ResourceType int32
type SendImageMessageParams ¶
type SendMessage ¶
type SendTextMessageParams ¶
type Server ¶
func (*Server) BotAndWsConnectionsSubKey ¶
func (*Server) CreateWsConnection ¶
func (*Server) GetSubscribedConnections ¶
func (server *Server) GetSubscribedConnections(botId string, resourceType int32) []*WsConnection
func (*Server) NewHubGRPCWrapper ¶
func (server *Server) NewHubGRPCWrapper() (*rpc.GRPCWrapper, error)
func (*Server) NewWebGRPCWrapper ¶
func (server *Server) NewWebGRPCWrapper() (*rpc.GRPCWrapper, error)
func (*Server) RecoverConnectionSubs ¶
func (server *Server) RecoverConnectionSubs()
func (*Server) RemoveSubsForConnection ¶
func (server *Server) RemoveSubsForConnection(wsConnection *WsConnection) error
func (*Server) ServeWebsocketServer ¶
func (*Server) StartHubClient ¶
func (server *Server) StartHubClient()
func (*Server) UpdateConnectionSubs ¶
func (server *Server) UpdateConnectionSubs(wsConnection *WsConnection, resources []*pb.StreamingResource) error
type WsConnection ¶
type WsConnection struct {
// contains filtered or unexported fields
}
func (*WsConnection) Close ¶
func (wsConnection *WsConnection) Close() error
func (*WsConnection) CreateRequest ¶
func (wsConnection *WsConnection) CreateRequest(eventType string, payload interface{}) *WsEvent
func (*WsConnection) On ¶
func (wsConnection *WsConnection) On(eventName string, eventHandler WsEventEventHandlerFunc)
func (*WsConnection) Send ¶
func (wsConnection *WsConnection) Send(event *WsEvent)
func (*WsConnection) SendHubBotAction ¶
func (wsConnection *WsConnection) SendHubBotAction(botLogin string, actionType string, actionBody string) (*httpx.RestfulResponse, error)
func (*WsConnection) SendWithAck ¶
func (wsConnection *WsConnection) SendWithAck(event *WsEvent, ack WsEventAckFunc)
type WsEvent ¶
type WsEvent struct { Seq int64 `json:"seq,omitempty"` Ack int64 `json:"ack,omitempty"` NeedAck bool `json:"needAck,omitempty"` EventType string `json:"eventType,omitempty"` Payload interface{} `json:"payload,omitempty"` Error *WsEventError `json:"error,omitempty"` }
func (*WsEvent) CreateErrorResponse ¶
func (*WsEvent) CreateResponse ¶
type WsEventAckFunc ¶
type WsEventAckFunc = func(payload interface{}, err error)
type WsEventAckWrapper ¶
type WsEventAckWrapper struct {
// contains filtered or unexported fields
}
type WsEventError ¶
func (*WsEventError) Error ¶
func (error *WsEventError) Error() string
type WsEventEventHandlerFunc ¶
type WsEventEventHandlerFunc = func(payload interface{}) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.