Documentation ¶
Index ¶
- Variables
- type Credentials
- type WebSocketClient
- func (conn *WebSocketClient) AttemptReconnect(retries int64) *websocket.Conn
- func (conn *WebSocketClient) Connect() *websocket.Conn
- func (conn *WebSocketClient) ConnectWithRetry(retries int64) *websocket.Conn
- func (conn *WebSocketClient) Stop()
- func (conn *WebSocketClient) Write(p []byte) (int, error)
- func (conn *WebSocketClient) WriteBinary(byData []byte) error
- func (conn *WebSocketClient) WriteJSON(payload interface{}) error
- type WebSocketMessageCallback
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidConnection connection is not valid ErrInvalidConnection = errors.New("connection is not valid") )
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct { Host string `validate:"required"` Channel string `validate:"required"` AccessKey string `validate:"required"` RedirectService bool SkipServerAuth bool }
Credentials is the input needed to login to the Symbl.ai platform
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
WebSocketClient return websocket client connection
func NewWebSocketClient ¶
func NewWebSocketClient(ctx context.Context, creds Credentials, callback WebSocketMessageCallback) (*WebSocketClient, error)
NewWebSocketClient create new websocket connection
func (*WebSocketClient) AttemptReconnect ¶
func (conn *WebSocketClient) AttemptReconnect(retries int64) *websocket.Conn
AttemptReconnect does exactly that...
func (*WebSocketClient) Connect ¶
func (conn *WebSocketClient) Connect() *websocket.Conn
Connect performs a websocket connection with "defaultConnectRetry" number of retries.
func (*WebSocketClient) ConnectWithRetry ¶
func (conn *WebSocketClient) ConnectWithRetry(retries int64) *websocket.Conn
ConnectWithRetry is a function to explicitly do a reconnect
func (*WebSocketClient) Stop ¶
func (conn *WebSocketClient) Stop()
Stop will send close message and shutdown websocket connection
func (*WebSocketClient) Write ¶
func (conn *WebSocketClient) Write(p []byte) (int, error)
Write performs the lower level websocket write operation
func (*WebSocketClient) WriteBinary ¶
func (conn *WebSocketClient) WriteBinary(byData []byte) error
WriteBinary writes a Go struct to the websocket server
func (*WebSocketClient) WriteJSON ¶
func (conn *WebSocketClient) WriteJSON(payload interface{}) error
WriteJSON writes a JSON payload to the websocket server
type WebSocketMessageCallback ¶
WebSocketMessageCallback is a callback used to write a message on websocket without exposing the entire struct to the user