websocket

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: MPL-2.0 Imports: 8 Imported by: 0

README

go-web-plug

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ws

type Ws struct {
	// contains filtered or unexported fields
}
var Websocket Ws

Websocket exported as symbol named "Websocket"

func (*Ws) AppendCertsFromPem

func (w *Ws) AppendCertsFromPem(pemCerts []byte) bool

AppendCertsFromPem add a certificate to the certificate pool

func (*Ws) Close

func (w *Ws) Close() error

Close the websocket connection

func (*Ws) Connect

func (w *Ws) Connect() error

Connect connect to the websocket server

func (*Ws) Read

func (w *Ws) Read() (int, []byte, error)

Read a websocket message

func (*Ws) ReadJSON

func (w *Ws) ReadJSON(v interface{}) error

ReadJSON read a websocket message in json format

func (*Ws) Reconnect

func (w *Ws) Reconnect(b bool)

Reconnect set to true for automatic reconnecting

func (*Ws) SetCloseHandler

func (w *Ws) SetCloseHandler(f func(int, string) error)

SetCloseHandler set a close handler to call when a connection ends

func (*Ws) SetInitMsg

func (w *Ws) SetInitMsg(msg []byte)

SetInitMsg set a message to be send when a connection is established

func (*Ws) SetSecure

func (w *Ws) SetSecure(b bool)

SetSecure set the secure bit

func (*Ws) SetUrl

func (w *Ws) SetUrl(scheme, host, path string)

SetUrl set the url to connect to

func (*Ws) Version

func (w *Ws) Version() string

Version return the current version number

func (*Ws) WriteJSON

func (w *Ws) WriteJSON(v interface{}) error

WriteJSON write a message in json format

func (*Ws) WriteMessage

func (w *Ws) WriteMessage(messageType int, data []byte) error

WriteMessage write a message

func (*Ws) WriteQueue

func (w *Ws) WriteQueue(c chan []byte, e chan error)

WriteQueue requires a channel te read message from and a channel to send errors to if wil requeue failed messages until the queue is filled, then it will throw them away todo create a way to remove old message when the queue is filling up so that there is space for new message

Jump to

Keyboard shortcuts

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