Documentation ¶
Index ¶
- func GetRawStream(s common.Stream) (stream io.ReadCloser, err error)
- type Config
- type RequestHandler
- type Response
- type Server
- func (s *Server) AddMessageHandler(opcode int, handler RequestHandler)
- func (s *Server) Close() error
- func (s *Server) HandleError(err error, c echo.Context)
- func (s *Server) RemoveMessageHandler(opcode int)
- func (s *Server) Shutdown(context context.Context) (err error)
- func (s *Server) Start(addr string) (err error)
- func (s *Server) StartWithTLS(addr string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRawStream ¶ added in v1.0.0
func GetRawStream(s common.Stream) (stream io.ReadCloser, err error)
GetRawStream returns a decoded stream from a common.Stream
Types ¶
type Config ¶ added in v0.3.0
type Config struct { MusixMatchUserToken string MusixMatchOBUserToken string Plugins []*plugin.Plugin RadioEnabled bool StaticFilesPath string DefaultMusicSource string }
Config contains Server's configuration
type RequestHandler ¶ added in v0.7.5
RequestHandler is a function that handles a request from user.
type Response ¶ added in v0.6.0
type Response struct { Operation int `json:"op"` Success bool `json:"success"` Reason string `json:"reason"` Data map[string]interface{} `json:"data"` Nonce int `json:"nonce"` }
Response will be encode in JSON and send to user
func (Response) EncodeJSON ¶ added in v0.6.0
EncodeJSON encodes Response to JSON
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a MusicStream server
func (*Server) AddMessageHandler ¶ added in v0.7.5
func (s *Server) AddMessageHandler(opcode int, handler RequestHandler)
AddMessageHandler registers a new message handler for the specified opcode
func (*Server) HandleError ¶ added in v0.6.0
HandleError defines an error handler that complies with echo's standards.
func (*Server) RemoveMessageHandler ¶ added in v0.7.5
RemoveMessageHandler unregisters the specified opcode
func (*Server) StartWithTLS ¶ added in v0.4.0
StartWithTLS starts the server, listening at addr, also tries to get a cert from LetsEncrypt
Click to show internal directories.
Click to hide internal directories.