server

package
v0.0.0-...-486f928 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type MessageType `json:"type"`
	Data interface{} `json:"data"`
}

func NewMessage

func NewMessage(ty MessageType, data interface{}) *Message

func (*Message) Handle

func (m *Message) Handle(ctrl *controller.Controller, conn *websocket.Conn)

func (*Message) Send

func (m *Message) Send(conn *websocket.Conn)

type MessageType

type MessageType string
const (
	Test            MessageType = "test"
	Status          MessageType = "status"
	ChannelDef      MessageType = "channel_def"
	SequencerDef    MessageType = "sequencer_def"
	SetSequencerDef MessageType = "set_sequencer_def"
	Play            MessageType = "play"
	Stop            MessageType = "stop"
	Pause           MessageType = "pause"
	Rewind          MessageType = "rewind"
	GoToTime        MessageType = "goto"
	Load            MessageType = "load"
	Save            MessageType = "save"
	ForceReload     MessageType = "force_reload"
	SetMasterGain   MessageType = "set_master_gain"
)

type ResponseMessage

type ResponseMessage struct {
	Type MessageType `json:"type"`
	Data interface{} `json:"data"`
}

type Server

type Server struct {
	Controller *controller.Controller
	Clients    []*websocket.Conn
}

func NewServer

func NewServer() *Server

func (*Server) Broadcast

func (s *Server) Broadcast(msg *Message)

func (*Server) HandleEvent

func (s *Server) HandleEvent(ev *ui.UIEvent)

func (*Server) Start

func (s *Server) Start(ctrl *controller.Controller) *Server

func (*Server) Websocket

func (s *Server) Websocket(w http.ResponseWriter, r *http.Request)

type StatusResponse

type StatusResponse struct {
	BPM         float64 `json:"bpm"`
	Playing     bool    `json:"playing"`
	Granularity int     `json:"granularity"`
	Time        uint    `json:"time"`
	MasterGain  float64 `json:"master_gain"`
}

Jump to

Keyboard shortcuts

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