Documentation ¶
Index ¶
- func Middleware(h http.Handler, middleware ...func(http.Handler) http.Handler) http.Handler
- type AuthApiKeyValidateFunc
- type Message
- type MessageHandlerFunc
- type SocketIOEndpoint
- type SocketIOMessageHandlerFunc
- type SocketIOOption
- type SocketIOServer
- type WebSocketClient
- type WebSocketOption
- type WebSocketServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthApiKeyValidateFunc ¶
ws header auth: by api-key
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
ws message format:
func (*Message) ToProtoBuf ¶
type MessageHandlerFunc ¶
接收消息+处理+生成待发送消息:
type SocketIOEndpoint ¶
type SocketIOEndpoint struct { Endpoint string Handler SocketIOMessageHandlerFunc }
type SocketIOOption ¶
type SocketIOOption struct { Addr string Endpoints []SocketIOEndpoint }
type SocketIOServer ¶
type SocketIOServer struct {
// contains filtered or unexported fields
}
server side:
func NewSocketIOServer ¶
func NewSocketIOServer(opt *SocketIOOption) *SocketIOServer
func (*SocketIOServer) RunV2 ¶
func (m *SocketIOServer) RunV2(port int)
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
client side:
func NewWebSocketClient ¶
func NewWebSocketClient() *WebSocketClient
type WebSocketOption ¶
type WebSocketOption struct { Addr string Host string Port int // contains filtered or unexported fields }
func (*WebSocketOption) Uri ¶
func (m *WebSocketOption) Uri() string
type WebSocketServer ¶
type WebSocketServer struct {
// contains filtered or unexported fields
}
server side:
func NewWebSocketServer ¶
func NewWebSocketServer(msgHandler MessageHandlerFunc, authValidator AuthApiKeyValidateFunc) *WebSocketServer
func (*WebSocketServer) Dispatch ¶
func (m *WebSocketServer) Dispatch(w http.ResponseWriter, r *http.Request)
处理消息:
func (*WebSocketServer) DispatchWithAuth ¶
func (m *WebSocketServer) DispatchWithAuth(middleware ...func(http.Handler) http.Handler) (h http.Handler)
鉴权: http header key
Source Files ¶
Click to show internal directories.
Click to hide internal directories.