Documentation
¶
Overview ¶
Package communicator implements a base communicator for network connections.
Index ¶
- Variables
- type IWebSocketChannel
- type WebSocketChannel
- func (c *WebSocketChannel) Close() error
- func (c *WebSocketChannel) GetChannelToken() string
- func (c *WebSocketChannel) GetStreamURL() string
- func (c *WebSocketChannel) IsOpen() bool
- func (c *WebSocketChannel) Open() error
- func (c *WebSocketChannel) ReadMessage() ([]byte, error)
- func (c *WebSocketChannel) SendMessage(input []byte, inputType int) error
- func (c *WebSocketChannel) SetChannelToken(channelToken string)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type IWebSocketChannel ¶
type IWebSocketChannel interface {
Open() error
Close() error
ReadMessage() ([]byte, error)
SendMessage(input []byte, inputType int) error
GetChannelToken() string
GetStreamURL() string
SetChannelToken(channelToken string)
}
IWebSocketChannel is the interface for DataChannel.
type WebSocketChannel ¶
type WebSocketChannel struct {
// contains filtered or unexported fields
}
WebSocketChannel parent class for DataChannel.
func NewWebSocketChannel ¶
func NewWebSocketChannel(channelURL string, channelToken string, logger log.T) (*WebSocketChannel, error)
NewWebSocketChannel creates a WebSocketChannel.
func (*WebSocketChannel) Close ¶
func (c *WebSocketChannel) Close() error
Close closes the corresponding connection.
func (*WebSocketChannel) GetChannelToken ¶
func (c *WebSocketChannel) GetChannelToken() string
GetChannelToken gets the channel token.
func (*WebSocketChannel) GetStreamURL ¶
func (c *WebSocketChannel) GetStreamURL() string
GetStreamURL gets stream url.
func (*WebSocketChannel) IsOpen ¶
func (c *WebSocketChannel) IsOpen() bool
IsOpen checks if the channel is open.
func (*WebSocketChannel) Open ¶
func (c *WebSocketChannel) Open() error
Open upgrades the http connection to a websocket connection.
func (*WebSocketChannel) ReadMessage ¶ added in v0.2.0
func (c *WebSocketChannel) ReadMessage() ([]byte, error)
ReadMessage reads a message from the websocket connection.
func (*WebSocketChannel) SendMessage ¶
func (c *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) SetChannelToken ¶
func (c *WebSocketChannel) SetChannelToken(channelToken string)
SetChannelToken sets the channel token.