Version: v1.0.1 Latest Latest

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

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 6 Imported by: 0



Package client contains basic types for clients implementations



This section is empty.


View Source
var BinaryOutError = errors.New("binary output detected")

BinaryOutError returned if client receives binary data and attempts to print if to stdout. However you can still print binary data if "output" flag explicitly set to "-".

View Source
var ErrBadHandshake = errors.New("bad handshake")

ErrBadHandshake returned by client constructor on bad handshake


This section is empty.


type BinaryCheckWriter

type BinaryCheckWriter struct {
	Opts *config.Options

BinaryCheckWriter checks if we attempt to write binary data to terminal.

func (*BinaryCheckWriter) Write

func (b *BinaryCheckWriter) Write(p []byte) (n int, err error)

Writer implements io.Writer interface.

type Client

type Client interface {
	// ReadTo reads all websocket text/binary message to given writer.
	// Useful for streams reading
	ReadTo(writer io.Writer) error

	// Ping sends ping message to server with given payload
	Ping(payload []byte) error

	// WriteSingleMessage sends message of given type with given payload
	WriteSingleMessage(payload []byte, messageType MessageType) error

	// WriteJSONMessage encodes 'obj' to JSON and sends it to server
	WriteJSONMessage(obj interface{}) error

	// WriteMessageFrom sends message from given reader
	WriteMessageFrom(reader io.Reader) error


Client is an interface for websocket operations

type Constructor

type Constructor func(url string, opts *config.Options) (Client, *http.Response, error)

Constructor is a type for client constructors

type MessageType

type MessageType int

MessageType determines frame types. The message types are defined in RFC 6455, section 11.8.

const (
	// TextMessage denotes a text data message. The text message payload is
	// interpreted as UTF-8 encoded text data.
	TextMessage MessageType = 1

	// BinaryMessage denotes a binary data message.
	BinaryMessage MessageType = 2

	// CloseMessage denotes a close control message. The optional message
	// payload contains a numeric code and text. Use the FormatCloseMessage
	// function to format a close message payload.
	CloseMessage MessageType = 8

	// PingMessage denotes a ping control message. The optional message payload
	// is UTF-8 encoded text.
	PingMessage MessageType = 9

	// PongMessage denotes a ping control message. The optional message payload
	// is UTF-8 encoded text.
	PongMessage MessageType = 10


Path Synopsis
Package gorilla contains websocket client implementation using "" library.
Package gorilla contains websocket client implementation using "" library.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL