websocketv1

package
v1.6.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PackageVersion string = "v1.0"
)

Variables

View Source
var (
	// ErrInvalidInput required input was not found
	ErrInvalidInput = errors.New("required input was not found")

	// ErrInvalidMessageType invalid message type
	ErrInvalidMessageType = errors.New("invalid message type")

	// ErrUserCallbackNotDefined user callback object not defined
	ErrUserCallbackNotDefined = errors.New("user callback object not defined")
)

errors

Functions

This section is empty.

Types

type CallbackRouter

type CallbackRouter struct {
	// contains filtered or unexported fields
}

CallbackRouter routes events

func NewCallbackRouter

func NewCallbackRouter(callback interfaces.SpeakMessageCallback) *CallbackRouter

New creates a CallbackRouter with a user-defined callback

func NewCallbackWithDefault

func NewCallbackWithDefault() *CallbackRouter

NewWithDefault creates a CallbackRouter with the default callback handler

func (*CallbackRouter) Binary

func (r *CallbackRouter) Binary(byMsg []byte) error

Binary handles binary messages

func (*CallbackRouter) Close

CloseHelper handles the OpenResponse message

func (*CallbackRouter) Error

ErrorHelper handles the ErrorResponse message

func (*CallbackRouter) Message

func (r *CallbackRouter) Message(byMsg []byte) error

Message handles platform messages and routes them appropriately based on the MessageType

func (*CallbackRouter) Open

OpenHelper handles the OpenResponse message

func (*CallbackRouter) UnhandledMessage

func (r *CallbackRouter) UnhandledMessage(byMsg []byte) error

UnhandledMessage logs and handles any unexpected message types

type ChanRouter

type ChanRouter struct {
	// contains filtered or unexported fields
}

ChanRouter routes events

func NewChanRouter

func NewChanRouter(chans interfaces.SpeakMessageChan) *ChanRouter

New creates a ChanRouter with a user-defined channels gocritic:ignore

func NewChanRouterWithDefault

func NewChanRouterWithDefault() *ChanRouter

NewWithDefault creates a ChanRouter with the default callback handler

func (*ChanRouter) Binary

func (r *ChanRouter) Binary(byMsg []byte) error

Binary handles platform messages and routes them appropriately based on the MessageType

func (*ChanRouter) Close

func (r *ChanRouter) Close(cr *interfaces.CloseResponse) error

Close sends an CloseResponse message to the callback

func (*ChanRouter) Error

func (r *ChanRouter) Error(er *interfaces.ErrorResponse) error

Error sends an ErrorResponse message to the callback

func (*ChanRouter) Message

func (r *ChanRouter) Message(byMsg []byte) error

Message handles platform messages and routes them appropriately based on the MessageType

func (*ChanRouter) Open

func (r *ChanRouter) Open(or *interfaces.OpenResponse) error

Open sends an OpenResponse message to the callback

func (*ChanRouter) UnhandledMessage

func (r *ChanRouter) UnhandledMessage(byMsg []byte) error

UnhandledMessage logs and handles any unexpected message types

type DefaultCallbackHandler

type DefaultCallbackHandler struct {
	// contains filtered or unexported fields
}

Using Callbacks

DefaultCallbackHandler is a default callback handler for live transcription Simply prints the transcript to stdout

func NewDefaultCallbackHandler

func NewDefaultCallbackHandler() *DefaultCallbackHandler

NewDefaultCallbackHandler creates a new DefaultCallbackHandler

func (DefaultCallbackHandler) Binary

func (dch DefaultCallbackHandler) Binary(br []byte) error

Binary is the callback for when the connection receives binary data

func (DefaultCallbackHandler) Close

Close is the callback for when the connection closes

func (DefaultCallbackHandler) Error

Error is the callback for error messages

func (DefaultCallbackHandler) Flush

Flushed is the callback for when the connection flushes

func (DefaultCallbackHandler) Metadata

Metadata is the callback for information about the connection

func (DefaultCallbackHandler) Open

Open is the callback for when the connection opens

func (DefaultCallbackHandler) UnhandledEvent

func (dch DefaultCallbackHandler) UnhandledEvent(byData []byte) error

UnhandledEvent is the callback for unknown messages

func (DefaultCallbackHandler) Warning

Warning is the callback for error messages

type DefaultChanHandler

type DefaultChanHandler struct {
	// contains filtered or unexported fields
}

Using Channels

DefaultCallbackHandler is a default callback handler for live transcription Simply prints the transcript to stdout

func NewDefaultChanHandler

func NewDefaultChanHandler() DefaultChanHandler

NewDefaultChanHandler creates a new DefaultChanHandler

func (DefaultChanHandler) GetBinary

func (dch DefaultChanHandler) GetBinary() []*chan *[]byte

GetBinary returns the binary event channels

func (DefaultChanHandler) GetClose

func (dch DefaultChanHandler) GetClose() []*chan *interfaces.CloseResponse

GetClose returns the close channels

func (DefaultChanHandler) GetError

func (dch DefaultChanHandler) GetError() []*chan *interfaces.ErrorResponse

GetError returns the error channels

func (DefaultChanHandler) GetFlush

func (dch DefaultChanHandler) GetFlush() []*chan *interfaces.FlushedResponse

GetfFlush returns the flush channels

func (DefaultChanHandler) GetMetadata

func (dch DefaultChanHandler) GetMetadata() []*chan *interfaces.MetadataResponse

GetMetadata returns the metadata channels

func (DefaultChanHandler) GetOpen

func (dch DefaultChanHandler) GetOpen() []*chan *interfaces.OpenResponse

GetOpen returns the open channels

func (DefaultChanHandler) GetUnhandled

func (dch DefaultChanHandler) GetUnhandled() []*chan *[]byte

GetUnhandled returns the unhandled event channels

func (DefaultChanHandler) GetWarning

func (dch DefaultChanHandler) GetWarning() []*chan *interfaces.WarningResponse

GetWarning returns the warning channels

func (DefaultChanHandler) Run

func (dch DefaultChanHandler) Run() error

Open is the callback for when the connection opens

type MessageRouter

type MessageRouter = CallbackRouter

MessageRouter is the interface for routing messages Deprecated: Use CallbackRouter instead

Directories

Path Synopsis
This package defines interfaces for the live API
This package defines interfaces for the live API

Jump to

Keyboard shortcuts

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