wsproxy

package
v0.0.0-...-511b1a1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(conn1, conn2 Conn) error

Copy copies messages back and forth between the provided WebSocket connections.

Types

type Conn

type Conn interface {
	// NextReader returns the next data message received from the peer. The
	// returned messageType is either TextMessage or BinaryMessage.
	NextReader() (messageType int, r io.Reader, err error)
	// NextWriter returns a writer for the next message to send. The writer's
	// Close method flushes the complete message to the network.
	NextWriter(messageType int) (io.WriteCloser, error)
}

Conn is a WebSocket connection that can be managed through data message readers and writers.

func NewConnWithHooks

func NewConnWithHooks(conn Conn, onInput func()) Conn

NewConnWithHooks creates and returns a new connection that executes the given onInput function every time data is received.

Jump to

Keyboard shortcuts

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