websocket

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func Connect

func Connect(url string, handler Handler) *Client

func (*Client) Close

func (cli *Client) Close()

func (*Client) Closed

func (cli *Client) Closed() bool

func (*Client) JSValue

func (cli *Client) JSValue() js.Value

func (*Client) SendBinary

func (cli *Client) SendBinary(buf []byte)

func (*Client) SentText

func (cli *Client) SentText(msg string)

func (*Client) State

func (cli *Client) State() State

func (*Client) URL

func (cli *Client) URL() string

type Handler

type Handler interface {
	ServeText(msg string)
	ServeBinary(data []byte)
	Opened()
	Failed()
	Closed()
}

type State

type State uint16

State represents websocket ready state.

const (
	Connecting State = 0
	Open       State = 1
	Closing    State = 2
	Closed     State = 3
)

websocket ready state valeus.

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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