wsclient

package
v0.0.0-...-c640e2a Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr struct {
	MaxReconnets int
	MaxDrops     int
	Authenticate bool
	Addr         string
	Clusters     []string

	EnableCompression bool
	Headers           map[string]string
	Dialer            *websocket.Dialer
}

Attr defines a struct which holds configuration options for the websocket client.

type WebSocketPod

type WebSocketPod struct {
	// contains filtered or unexported fields
}

WebSocketPod defines a websocket implementation which connects to a provided websocket endpoint for making requests.

func New

func New(insts octo.Instrumentation, attr Attr) (*WebSocketPod, error)

New returns a new instance of the websocket pod.

func (*WebSocketPod) Close

func (w *WebSocketPod) Close() error

Close closes the websocket connection.

func (*WebSocketPod) Listen

func (w *WebSocketPod) Listen(sm client.SystemServer, encoding octo.MessageEncoding) error

Listen calls the connection to be create and begins serving requests.

func (*WebSocketPod) Register

func (w *WebSocketPod) Register(tm client.StateHandlerType, hmi interface{})

Register registers the handler for a given handler.

func (*WebSocketPod) Send

func (w *WebSocketPod) Send(data interface{}, flush bool) error

Send delivers the giving message to the underline websocket connection.

type WebsocketAttr

type WebsocketAttr struct {
	EnableCompression bool
	Headers           map[string]string
	Dialer            *websocket.Dialer
}

WebsocketAttr defines a struct which holds configuration options for the websocket client.

type WebsocketConn

type WebsocketConn struct {
	// contains filtered or unexported fields
}

WebsocketConn defines a struct which handles the underline connection procedure for communicating through websocket connections.

func NewWebsocketConn

func NewWebsocketConn(addr string, attr WebsocketAttr) (*WebsocketConn, error)

NewWebsocketConn returns a new WebsocketConn intance using the provided WebsocketAttr.

func (*WebsocketConn) Close

func (t *WebsocketConn) Close() error

Close ends and disposes of the internal connection, closing it and all reads and writers.

func (*WebsocketConn) Read

func (t *WebsocketConn) Read() ([]byte, error)

Read returns the byte slice read from the websocket connections.

func (*WebsocketConn) SetReadDeadline

func (t *WebsocketConn) SetReadDeadline(tl time.Time)

SetReadDeadline sets the read deadline of the connection.

func (*WebsocketConn) SetWriteDeadline

func (t *WebsocketConn) SetWriteDeadline(tl time.Time)

SetWriteDeadline sets the read deadline of the connection.

func (*WebsocketConn) Write

func (t *WebsocketConn) Write(bm []byte, flush bool) error

Write writes the byte slice read from the websocket connections.

Jump to

Keyboard shortcuts

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