stream

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeadRequestTimeout = 8 * time.Second
)

Variables

This section is empty.

Functions

func SetVerbose

func SetVerbose(value bool)

SetVerbose enables or disables verbose logging

Types

type CloudError

type CloudError struct {
	Kind cloud.ErrorType
	Err  error
}

type Conn

type Conn interface {
	Close() error
	CloseSend() error
	SendAudio([]byte) error
	WaitForResponse() (interface{}, error)
}

type ConnectFunc

type ConnectFunc func(context.Context) (Conn, *CloudError)

type Option

type Option func(o *options)

func WithChipperURL

func WithChipperURL(url string) Option

func WithConnectFunc

func WithConnectFunc(connectFn ConnectFunc) Option

WithConnectFunc allows tests to provide a separate connection interface for the streamer, to mock connections instead of using real ones

func WithConnectionCheckOptions

func WithConnectionCheckOptions(opts chipper.ConnectOpts) Option

func WithIntentOptions

func WithIntentOptions(opts chipper.IntentOpts, mode cloud.StreamType) Option

func WithKnowledgeGraphOptions

func WithKnowledgeGraphOptions(opts chipper.KGOpts) Option

func WithTokener

func WithTokener(t token.Accessor, require bool) Option

type Receiver

type Receiver interface {
	OnError(cloud.ErrorType, error)
	OnStreamOpen(string)
	OnIntent(*cloud.IntentResult)
	OnConnectionResult(*cloud.ConnectionResult)
}

type Streamer

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

func NewStreamer

func NewStreamer(ctx context.Context, receiver Receiver, streamSize int, opts ...Option) *Streamer

func (*Streamer) AddBytes

func (strm *Streamer) AddBytes(bytes []byte)

func (*Streamer) AddSamples

func (strm *Streamer) AddSamples(samples []int16)

func (*Streamer) Close

func (strm *Streamer) Close() error

func (*Streamer) CloseSend

func (strm *Streamer) CloseSend() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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