channel

package
v0.0.0-...-028f1de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISessionChannel

type ISessionChannel interface {
	Open() error
	Close() error
	Reconnect() error
	SendStreamDataMessage(inputData []byte) (err error)
	GetChannelId() string
	IsActive() bool
}

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 InputStreamMessageHandler

type InputStreamMessageHandler func(streamDataMessage message.Message) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL