websocket

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: GPL-2.0 Imports: 5 Imported by: 1

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageEvent

type MessageEvent js.Value

func (MessageEvent) Data

func (m MessageEvent) Data() js.Value

func (MessageEvent) LastEventId

func (m MessageEvent) LastEventId() string

func (MessageEvent) Origin

func (m MessageEvent) Origin() string

func (MessageEvent) Ports

func (m MessageEvent) Ports() js.Value

func (MessageEvent) Source

func (m MessageEvent) Source() js.Value

func (MessageEvent) Target

func (m MessageEvent) Target() js.Value

type ReadyState

type ReadyState int
const (
	SockConnecting ReadyState = 0
	SockOpen       ReadyState = 1
	SockClosing    ReadyState = 2
	SockClosed     ReadyState = 3
)

func (ReadyState) Is

func (r ReadyState) Is(c ReadyState) bool

func (ReadyState) String

func (r ReadyState) String() string

type WebSocket

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

func New

func New(url string, protocols ...string) *WebSocket

func Open

func Open(url string, protocols ...string) (*WebSocket, error)

func (*WebSocket) BinaryType

func (w *WebSocket) BinaryType(s ...string) string

func (*WebSocket) BufferedAmount

func (w *WebSocket) BufferedAmount() int

func (*WebSocket) Close

func (w *WebSocket) Close(args ...any)

func (*WebSocket) CloseReasoned

func (w *WebSocket) CloseReasoned(code int, reason string)

func (*WebSocket) Extensions

func (w *WebSocket) Extensions() string

func (*WebSocket) IsOpen

func (w *WebSocket) IsOpen() bool

func (*WebSocket) MarshalJS added in v2.7.6

func (w *WebSocket) MarshalJS() js.Value

func (*WebSocket) OnClose

func (w *WebSocket) OnClose(f func(w *WebSocket, e jsext.Event))

func (*WebSocket) OnError

func (w *WebSocket) OnError(f func(w *WebSocket, e jsext.Event))

func (*WebSocket) OnMessage

func (w *WebSocket) OnMessage(f func(w *WebSocket, e MessageEvent))

func (*WebSocket) OnOpen

func (w *WebSocket) OnOpen(f func(w *WebSocket, e MessageEvent))

func (*WebSocket) Protocol

func (w *WebSocket) Protocol() string

func (*WebSocket) ReadyState

func (w *WebSocket) ReadyState() ReadyState

func (*WebSocket) Reconnect added in v2.7.3

func (w *WebSocket) Reconnect() error

func (*WebSocket) SendBytes

func (w *WebSocket) SendBytes(data []byte) error

Will convert the bytes to a string, unless connection is binary.

func (*WebSocket) SendJSON

func (w *WebSocket) SendJSON(v interface{}) error

func (*WebSocket) URL

func (w *WebSocket) URL() string

func (*WebSocket) Value

func (w *WebSocket) Value() js.Value

Jump to

Keyboard shortcuts

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