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.
Click to show internal directories.
Click to hide internal directories.