live

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

This package defines the live API for Deepgram

Index

Constants

This section is empty.

Variables

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

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

Functions

This section is empty.

Types

type DefaultCallbackHandler

type DefaultCallbackHandler struct{}

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) Close added in v1.1.6

Close is the callback for when the connection closes

func (DefaultCallbackHandler) Error

Error is the callback for a error messages

func (DefaultCallbackHandler) Message

Message is the callback for a transcription message

func (DefaultCallbackHandler) Metadata

Metadata is the callback for information about the connection

func (DefaultCallbackHandler) Open added in v1.1.6

Open is the callback for when the connection opens

func (DefaultCallbackHandler) SpeechStarted added in v1.1.1

SpeechStarted is when VAD detects noise

func (DefaultCallbackHandler) UnhandledEvent added in v1.1.6

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

UnhandledEvent is the callback for unknown messages

func (DefaultCallbackHandler) UtteranceEnd added in v1.0.2

UtteranceEnd is the callback for when a channel goes silent

type MessageRouter

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

MessageRouter is helper struct that routes events

func New

New creates a MessageRouter with user defined callback

func NewWithDefault

func NewWithDefault() *MessageRouter

NewWithDefault creates a default MessageRouter

func (*MessageRouter) CloseHelper added in v1.1.6

func (r *MessageRouter) CloseHelper(cr *interfaces.CloseResponse) error

CloseHelper handles the CloseResponse message

func (*MessageRouter) CloseResponse added in v1.1.6

func (r *MessageRouter) CloseResponse(byMsg []byte) error

CloseResponse handles the CloseResponse message

func (*MessageRouter) ErrorResponse

func (r *MessageRouter) ErrorResponse(byMsg []byte) error

func (*MessageRouter) Message

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

Message handles platform messages

func (*MessageRouter) MessageResponse

func (r *MessageRouter) MessageResponse(byMsg []byte) error

MessageResponse handles the MessageResponse message

func (*MessageRouter) MetadataResponse

func (r *MessageRouter) MetadataResponse(byMsg []byte) error

func (*MessageRouter) OpenHelper added in v1.1.6

func (r *MessageRouter) OpenHelper(or *interfaces.OpenResponse) error

OpenResponse handles the OpenResponse message

func (*MessageRouter) OpenResponse added in v1.1.6

func (r *MessageRouter) OpenResponse(byMsg []byte) error

OpenResponse handles the OpenResponse message

func (*MessageRouter) SpeechStartedResponse added in v1.1.1

func (r *MessageRouter) SpeechStartedResponse(byMsg []byte) error

func (*MessageRouter) UnhandledMessage

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

UnhandledMessage handles the UnhandledMessage message

func (*MessageRouter) UtteranceEndResponse added in v1.0.2

func (r *MessageRouter) UtteranceEndResponse(byMsg []byte) error

type MessageType

type MessageType struct {
	Type string `json:"type"`
}

MessageType is the header to bootstrap you way unmarshalling other messages

Example:
{
	"type": "message",
	"message": {
		...
	}
}

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