service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartWebServer

func StartWebServer(data *Data) error

StartWebServer starts echo web service

Types

type Data

type Data struct {
	Port            int
	WSHandlerStatus *WSConnHandler
	WSHandlerSpeech *WSConnHandler
	Ctx             context.Context
}

Data keeps data required for service work

type Handler

type Handler interface {
	Process(context.Context, string) (string, error)
}

type WSConnHandler

type WSConnHandler struct {
	Middleware Handler
	// contains filtered or unexported fields
}

WSConnKeeper implements connection management

func NewWSHandler

func NewWSHandler(url string) *WSConnHandler

NewWSConnKeeper creates manager

func (*WSConnHandler) HandleConnection

func (kp *WSConnHandler) HandleConnection(ctx context.Context, conn *websocket.Conn, query string) error

HandleConnection loops until connection active and save connection with provided ID as key

type WsConn

type WsConn interface {
	ReadMessage() (messageType int, p []byte, err error)
	Close() error
	WriteJSON(v interface{}) error
}

Jump to

Keyboard shortcuts

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