Documentation
¶
Index ¶
- Constants
- type Message
- type Response
- type Server
- func (self *Server) Broadcast(message string)
- func (self *Server) GetNumClients() int
- func (self Server) HandleError(err error, conn net.Conn)
- func (self Server) HandleSuccess(data string, conn net.Conn)
- func (self *Server) Help() string
- func (self *Server) Log(message ...string)
- func (self *Server) RegisterMethod(method string, function func(Message, net.Conn)) error
- func (self Server) SendResponseFromStruct(data interface{}, conn net.Conn)
- func (self *Server) Shutdown()
- func (self *Server) Start()
Constants ¶
View Source
const ( TCP_DEFAULT_CONN_HOST = "localhost" TCP_DEFAULT_CONN_PORT = 3333 TCP_DEFAULT_CONN_TYPE = "tcp" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
Method string `json:"method"`
// Data interface{} `json:"data"`
Data json.RawMessage `json:data`
}
type Response ¶
type Response struct {
Status string `json:"status"`
Data interface{} `json:"data"`
}
type Server ¶
type Server struct {
Host string
Port int
ConnType string
NumClients int
LoggingHandler func(string)
OnDisconnect func(string)
MethodHandlers map[string]func(Message, net.Conn)
Clients map[int]net.Conn
// contains filtered or unexported fields
}
func (*Server) GetNumClients ¶
func (*Server) RegisterMethod ¶
func (Server) SendResponseFromStruct ¶
Click to show internal directories.
Click to hide internal directories.