Documentation
¶
Overview ¶
Package client contains basic types for clients implementations
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
Functions ¶
This section is empty.
Types ¶
type BinaryCheckWriter ¶
BinaryCheckWriter checks if we attempt to write binary data to terminal.
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 io.Closer }
Client is an interface for websocket operations
type Constructor ¶
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 )
Click to show internal directories.
Click to hide internal directories.