live

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 8 Imported by: 0

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

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

Open is the callback for when the connection opens

func (DefaultCallbackHandler) SpeechStarted

SpeechStarted is when VAD detects noise

func (DefaultCallbackHandler) UnhandledEvent

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

UnhandledEvent is the callback for unknown messages

func (DefaultCallbackHandler) UtteranceEnd

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

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

CloseHelper handles the CloseResponse message

func (*MessageRouter) CloseResponse

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

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

OpenResponse handles the OpenResponse message

func (*MessageRouter) OpenResponse

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

OpenResponse handles the OpenResponse message

func (*MessageRouter) SpeechStartedResponse

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

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