wsutil

package
v3.6.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebSocketHandler

func WebSocketHandler(h Handler) http.Handler

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

type WebSocketStream

type WebSocketStream struct {
	*websocket.Conn
}

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL