2022-12-20 16:26:04 -05:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"dynatron.me/x/blasphem/pkg/auth"
|
|
|
|
"dynatron.me/x/blasphem/pkg/bus"
|
|
|
|
"dynatron.me/x/blasphem/pkg/components"
|
|
|
|
"dynatron.me/x/blasphem/pkg/config"
|
|
|
|
"dynatron.me/x/blasphem/pkg/storage"
|
|
|
|
)
|
|
|
|
|
2022-12-20 19:05:45 -05:00
|
|
|
type Blas interface {
|
2022-12-20 16:26:04 -05:00
|
|
|
auth.Authenticator
|
|
|
|
bus.Bus
|
|
|
|
storage.Store
|
|
|
|
config.Configured
|
2022-12-20 19:05:45 -05:00
|
|
|
components.Componenter
|
|
|
|
|
|
|
|
WebSocketManager
|
|
|
|
|
2022-12-20 16:26:04 -05:00
|
|
|
Shutdowner
|
|
|
|
Versioner
|
|
|
|
}
|
|
|
|
|
2022-12-20 19:05:45 -05:00
|
|
|
type WebSocketManager interface {
|
|
|
|
// Register registers a websocket command.
|
|
|
|
// cmd is the first part, before first slash
|
|
|
|
// dataNew is a function to create a new message datatype
|
|
|
|
RegisterWSCommand(cmd string, hnd Handler, dataNew NewData)
|
|
|
|
WSCommandHandler(cmd string) (NewData, Handler, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type WebSocketSession interface {
|
|
|
|
Go() error
|
|
|
|
Blas() Blas
|
|
|
|
}
|
|
|
|
|
|
|
|
type Handler func(wss WebSocketSession, msg interface{}) error
|
|
|
|
type NewData func() interface{}
|
|
|
|
|
2022-12-20 16:26:04 -05:00
|
|
|
type Shutdowner interface {
|
|
|
|
ShutdownBlas(context.Context) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type Versioner interface {
|
|
|
|
Version() string
|
|
|
|
}
|