Documentation
¶
Overview ¶
This package defines interfaces for the live API
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseResponse ¶
type CloseResponse struct {
Type string `json:"type,omitempty"`
}
CloseResponse is the response from the connection closing
type ErrorResponse ¶
type ErrorResponse = interfaces.DeepgramError
ErrorResponse is the Deepgram specific response error
type OpenResponse ¶
type OpenResponse struct {
Type string `json:"type,omitempty"`
}
Shared Structs
OpenResponse is the response from the connection opening
type Router ¶
type Router interface {
Open(or *OpenResponse) error
Message(byMsg []byte) error
Binary(byMsg []byte) error
Close(or *CloseResponse) error
Error(er *ErrorResponse) error
}
Router definition
type TypeResponse ¶
type TypeResponse string
These are the message types that can be received from the live API
const ( // message types TypeOpenResponse TypeResponse = "Open" TypeCloseResponse TypeResponse = "Close" TypeErrorResponse TypeResponse = "Error" )
type WebSocketHandler ¶
type WebSocketHandler interface {
// GetURL returns the URL for the websocket connection. This has already been processed through pkg/api/version
GetURL(host string) (string, error)
// ProcessMessage is the entry point for processing messages based on that client's WS protocol
ProcessMessage(wsType int, byMsg []byte) error
// ProcessError handles any errors that occur during the WS connection
ProcessError(err error) error
// Start handles any setup required specific to that client's WS protocol
Start()
// Finish handles any cleanup required specific to that client's WS protocol
Finish()
// GetCloseMsg returns the message to send when closing the connection.
// It turns out that between clients, the close message can be different.
GetCloseMsg() []byte
}
WebSocketHandler this defines the things you need to implement for your specific WS protocol
Click to show internal directories.
Click to hide internal directories.