Documentation ¶
Index ¶
- type ISessionChannel
- type IWebSocketChannel
- type IWebsocketUtil
- type InputStreamMessageHandler
- type SessionChannel
- func (sessionChannel *SessionChannel) Close() error
- func (sessionChannel *SessionChannel) GetChannelId() string
- func (sessionChannel *SessionChannel) IsActive() bool
- func (sessionChannel *SessionChannel) Open() error
- func (sessionChannel *SessionChannel) Reconnect() error
- func (sessionChannel *SessionChannel) SendMessage(input []byte, inputType int) error
- func (sessionChannel *SessionChannel) SendStreamDataMessage(inputData []byte) (err error)
- type WebSocketChannel
- func (webSocketChannel *WebSocketChannel) Close() error
- func (webSocketChannel *WebSocketChannel) Initialize(channelUrl string, onMessageHandler func([]byte), onErrorHandler func(error)) error
- func (webSocketChannel *WebSocketChannel) IsActive() bool
- func (webSocketChannel *WebSocketChannel) Open() error
- func (webSocketChannel *WebSocketChannel) SendMessage(input []byte, inputType int) error
- func (webSocketChannel *WebSocketChannel) StartPings()
- type WebsocketUtil
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ISessionChannel ¶
type IWebSocketChannel ¶
type IWebSocketChannel interface { Initialize(channelUrl string, onMessageHandler func([]byte), onErrorHandler func(error)) error Open() error Close() error StartPings() IsActive() bool SendMessage(input []byte, inputType int) error }
IWebSocketChannel is the interface for ControlChannel and DataChannel.
type IWebsocketUtil ¶
type IWebsocketUtil interface { OpenConnection(url string, requestHeader http.Header) (*websocket.Conn, error) CloseConnection(ws *websocket.Conn) error }
IWebsocketUtil is the interface for the websocketutil.
type SessionChannel ¶
type SessionChannel struct { ChannelId string StreamDataSequenceNumber int64 // contains filtered or unexported fields }
func NewSessionChannel ¶
func NewSessionChannel(url string, sessionId string, inputStreamMessageHandler InputStreamMessageHandler, cancelFlag util.CancelFlag) (*SessionChannel, error)
func (*SessionChannel) Close ¶
func (sessionChannel *SessionChannel) Close() error
func (*SessionChannel) GetChannelId ¶
func (sessionChannel *SessionChannel) GetChannelId() string
func (*SessionChannel) IsActive ¶
func (sessionChannel *SessionChannel) IsActive() bool
func (*SessionChannel) Open ¶
func (sessionChannel *SessionChannel) Open() error
func (*SessionChannel) Reconnect ¶
func (sessionChannel *SessionChannel) Reconnect() error
func (*SessionChannel) SendMessage ¶
func (sessionChannel *SessionChannel) SendMessage(input []byte, inputType int) error
func (*SessionChannel) SendStreamDataMessage ¶
func (sessionChannel *SessionChannel) SendStreamDataMessage(inputData []byte) (err error)
SendStreamDataMessage sends a data message in a form of AgentMessage for streaming.
type WebSocketChannel ¶
type WebSocketChannel struct { OnMessage func([]byte) OnError func(error) Connection *websocket.Conn Url string IsOpen bool // contains filtered or unexported fields }
func (*WebSocketChannel) Close ¶
func (webSocketChannel *WebSocketChannel) Close() error
Close closes the corresponding connection.
func (*WebSocketChannel) Initialize ¶
func (webSocketChannel *WebSocketChannel) Initialize(channelUrl string, onMessageHandler func([]byte), onErrorHandler func(error)) error
func (*WebSocketChannel) IsActive ¶
func (webSocketChannel *WebSocketChannel) IsActive() bool
func (*WebSocketChannel) Open ¶
func (webSocketChannel *WebSocketChannel) Open() error
func (*WebSocketChannel) SendMessage ¶
func (webSocketChannel *WebSocketChannel) SendMessage(input []byte, inputType int) error
SendMessage sends a byte message through the websocket connection. Examples of message type are websocket.TextMessage or websocket.Binary
func (*WebSocketChannel) StartPings ¶
func (webSocketChannel *WebSocketChannel) StartPings()
StartPings starts the pinging process to keep the websocket channel alive.
type WebsocketUtil ¶
type WebsocketUtil struct {
// contains filtered or unexported fields
}
WebsocketUtil struct provides functionality around creating and maintaining websockets.
func NewWebsocketUtil ¶
func NewWebsocketUtil(logger logrus.FieldLogger, dialerInput *websocket.Dialer) *WebsocketUtil
func (*WebsocketUtil) CloseConnection ¶
func (u *WebsocketUtil) CloseConnection(ws *websocket.Conn) error
CloseConnection closes a websocket connection given the Conn object as input.
func (*WebsocketUtil) OpenConnection ¶
func (u *WebsocketUtil) OpenConnection(url string, requestHeader http.Header) (*websocket.Conn, error)
OpenConnection opens a websocket connection provided an input url and request header.