Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CheckServerMsgCallback ¶
type CheckServerMsgCallback func(w http.ResponseWriter, r *http.Request) error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
WebSocket 服务器实现.
func GetWebsocketSingleton ¶
func GetWebsocketSingleton() *Server
func (*Server) HttpHandler ¶
func (s *Server) HttpHandler() func(w http.ResponseWriter, r *http.Request)
func (*Server) SetState ¶
func (s *Server) SetState(status ServerState)
type ServerState ¶
type ServerState string
const ( SERVER_STATE_STARTING ServerState = "starting" SERVER_STATE_RUNNING ServerState = "running" SERVER_STATE_CLOSING ServerState = "closing" SERVER_STATE_STOP ServerState = "stop" )
type WebSocketConnect ¶
type WebSocketConnect struct {
// contains filtered or unexported fields
}
func NewWebSocketConnect ¶
func NewWebSocketConnect(conn *websocket.Conn) *WebSocketConnect
func (*WebSocketConnect) Close ¶
func (p *WebSocketConnect) Close()
func (*WebSocketConnect) ConnectId ¶
func (p *WebSocketConnect) ConnectId() string
func (*WebSocketConnect) LocalAddr ¶
func (s *WebSocketConnect) LocalAddr() string
func (*WebSocketConnect) Read ¶
func (p *WebSocketConnect) Read() ([]byte, error)
func (*WebSocketConnect) RemoteAddr ¶
func (s *WebSocketConnect) RemoteAddr() string
func (*WebSocketConnect) Write ¶
func (p *WebSocketConnect) Write(data []byte) error
Click to show internal directories.
Click to hide internal directories.