websocket

package
v0.0.0-...-9137930 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnectionNotEstablished is returned by methods that need a connection
	// but no connection is already created.
	ErrConnectionNotEstablished = errors.New("connection has not yet been established")
)

Functions

This section is empty.

Types

type ManagedConnection

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

ManagedConnection represents a websocket connection.

func NewDurableConnection

func NewDurableConnection(target string, messageChan chan []byte) *ManagedConnection

NewDurableConnection creates a new websocket connection, that passes incoming messages to the given message channel. It can also send messages to the endpoint it connects to. The connection will continuously be kept alive and reconnected in case of a loss of connectivity.

func NewDurableSendingConnection

func NewDurableSendingConnection(target string) *ManagedConnection

NewDurableSendingConnection creates a new websocket connection that can only send messages to the endpoint it connects to. The connection will continuously be kept alive and reconnected in case of a loss of connectivity.

func (*ManagedConnection) Close

func (c *ManagedConnection) Close() error

Close closes the websocket connection.

func (*ManagedConnection) Send

func (c *ManagedConnection) Send(msg interface{}) error

Send sends an encodable message over the websocket connection.

Jump to

Keyboard shortcuts

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