websocket

package
v1.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WriteWait defines time allowed to write a message to the peer.
	WriteWait = 10 * time.Second

	// PongWait defines time allowed to read the next pong message from the peer.
	PongWait = 30 * time.Second

	// PingPeriod defines send pings to peer with this period. Must be less than pongWait.
	PingPeriod = (PongWait * 9) / 10
)

Variables

View Source
var Upgrader = socket.Upgrader{

	CheckOrigin:     func(r *http.Request) bool { return true },
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

Upgrader ...

Functions

func FilterHeader

func FilterHeader(header http.Header) http.Header

FilterHeader filters the headers for upgrading the HTTP server connection to the WebSocket protocol.

func Send added in v0.9.7

func Send(ws *websocket.Conn, reader io.Reader, close <-chan struct{}) error

Send sends stream from reader by websocket

func SendStream added in v0.9.7

func SendStream(server string, reader io.Reader, close <-chan struct{}) error

SendStream sends stream from reader to a remote websocket

func Write added in v0.9.7

func Write(ws *websocket.Conn, reader ReadBytes, stop <-chan struct{}, stopDelaySeconds time.Duration) error

Write writes message from reader to websocket

Types

type ReadBytes added in v0.9.7

type ReadBytes interface {
	ReadBytes(delim byte) ([]byte, error)
}

ReadBytes reads and returns a single byte. If no byte is available, returns an error.

Jump to

Keyboard shortcuts

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