Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContainer ¶
func NewContainer(addr string, apps []WebsocketApplication, opts ...WsOption) scene.Scene
Types ¶
type IWebsocketMux ¶ added in v0.2.5
type IWebsocketMux interface {
HandleFunc(pattern string, handler WebsocketHandler)
UsePrefix(pattern string) IWebsocketMux
}
IWebsocketMux is mux for websocket application
type WebSocketMux ¶ added in v0.2.5
type WebSocketMux struct {
UpgraderHandler WebsocketUpgraderHandler
// contains filtered or unexported fields
}
func NewWebSocketMux ¶
func NewWebSocketMux() *WebSocketMux
func (*WebSocketMux) HandleFunc ¶ added in v0.2.5
func (w *WebSocketMux) HandleFunc(pattern string, handler WebsocketHandler)
func (*WebSocketMux) ServeHTTP ¶ added in v0.2.5
func (w *WebSocketMux) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*WebSocketMux) UsePrefix ¶ added in v0.2.5
func (w *WebSocketMux) UsePrefix(pattern string) IWebsocketMux
type WebsocketApplication ¶
type WebsocketApplication interface {
scene.Application
Prefix() string
Create(mux IWebsocketMux) error
Destroy() error
}
type WebsocketHandler ¶
type WebsocketHandler func(request *http.Request, conn *websocket.Conn, clos func()) WebsocketMessageHandler
WebsocketHandler is a function that handles websocket connections clos is a function that can be called to close the connection
type WebsocketMessageHandler ¶
WebsocketMessageHandler is a function that handles websocket messages pass err from ReadMessage to WebsocketMessageHandler so that the handler can decide what to do with the error
type WebsocketUpgraderHandler ¶ added in v0.2.5
type WebsocketUpgraderHandler func(upgrader *websocket.Upgrader, handler WebsocketHandler) func(writer http.ResponseWriter, request *http.Request)
Click to show internal directories.
Click to hide internal directories.