35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
|
package protocol
|
||
|
|
||
|
import "context"
|
||
|
|
||
|
type Operations interface {
|
||
|
// Connect initiates a new connection to the ReachView service
|
||
|
// It should be called before any other operation
|
||
|
Connect(ctx context.Context) error
|
||
|
|
||
|
// Close closes the current connection to the ReachView service
|
||
|
Close(ctx context.Context) error
|
||
|
|
||
|
// Alive returns true if the ReachView websocket connection is alive, false otherwise
|
||
|
Alive(ctx context.Context) (bool, error)
|
||
|
|
||
|
// Version returns the current ReachView version,
|
||
|
// true if the module uses the stable channel or an error
|
||
|
Version(ctx context.Context) (string, bool, error)
|
||
|
|
||
|
// On listens for messages of the given type on ReachView websocket connection
|
||
|
On(ctx context.Context, mType string) (chan any, error)
|
||
|
|
||
|
// Emit sends the given message on the ReachView websocket connection
|
||
|
Emit(ctx context.Context, mType string, message any) error
|
||
|
|
||
|
// Configuration retrieves the module's configuration
|
||
|
Configuration(ctx context.Context) (any, error)
|
||
|
|
||
|
// SetBase updates the base configuration
|
||
|
SetBase(ctx context.Context, funcs ...SetBaseOptionFunc) error
|
||
|
|
||
|
// Reboot restarts the module
|
||
|
Reboot(ctx context.Context) error
|
||
|
}
|