Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WebSocketHandler ¶
Types ¶
type Handler ¶
type Handler interface {
ServeWS(http.ResponseWriter, *http.Request, *WebSocketStream)
}
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request, *WebSocketStream)
func (HandlerFunc) ServeWS ¶
func (f HandlerFunc) ServeWS(w http.ResponseWriter, r *http.Request, ws *WebSocketStream)
type WebSocketStream ¶
WebSocketStream wraps a websocket connection to provide error handling
func (*WebSocketStream) Fatalf ¶
func (s *WebSocketStream) Fatalf(format string, v ...interface{})
Fatalf sends the error back to the client, and closes the connection
func (*WebSocketStream) Forward ¶
func (s *WebSocketStream) Forward(ch chan string) error
Forward reads from channel and sends the values. Also pings the client periodically.
func (*WebSocketStream) Send ¶
func (s *WebSocketStream) Send(value string) error
Send sends the value back to the client
type WebSocketStreamError ¶
type WebSocketStreamError struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.