ws

package
v0.0.0-...-0c57d95 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	OnMessage        func([]byte, *Conn)
	OnError          func(error)
	OnConnected      func(*Conn)
	MatchMsg         func([]byte, []byte) bool
	Reconnect        bool
	PingMsg          []byte
	PingIntervalSecs int
	// contains filtered or unexported fields
}

Conn is the connection structure.

func (*Conn) Dial

func (c *Conn) Dial(url, subprotocol string) error

Dial sets up the connection with the remote host provided in the url parameter. Note that all the parameters of the structure must have been set before calling it.

func (*Conn) IsConnected

func (c *Conn) IsConnected() bool

IsConnected tells wether the connection is opened or closed.

func (*Conn) Send

func (c *Conn) Send(msg Msg) error

Send sends a message through the connection.

type Msg

type Msg struct {
	Body     []byte
	Callback func([]byte, *Conn)
}

Msg is the message structure.

Jump to

Keyboard shortcuts

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