websocket

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlobType        = "blob"
	ArrayBufferType = "arraybuffer"
)

Variables

View Source
var (
	//ErrNotImplemented ErrNotImplemented error
	ErrNotImplemented   = errors.New("Browser not implemented WebSocket")
	ErrSendUnknownType  = errors.New("Unknown type send data provide to send method")
	ErrSetBadBinaryType = errors.New("Bad Binary Type set")
	ErrNotAWebSocket    = errors.New("Object is not a webasocket")
)

Functions

func GetInterface

func GetInterface() js.Value

GetInterface get the JS interface

Types

type WebSocket

type WebSocket struct {
	eventtarget.EventTarget
}

Websocket struct

func New

func New(url string) (WebSocket, error)

New Get a new channel broadcast

func NewFromJSObject

func NewFromJSObject(obj js.Value) (WebSocket, error)

func (WebSocket) BinaryType

func (w WebSocket) BinaryType() (string, error)

func (WebSocket) BufferedAmount

func (w WebSocket) BufferedAmount() (int, error)

func (WebSocket) Close

func (w WebSocket) Close() error

func (WebSocket) OnClose

func (w WebSocket) OnClose(handler func(e event.Event)) (js.Func, error)

OnClose Set onClose Handler

func (WebSocket) OnError

func (w WebSocket) OnError(handler func(e event.Event)) (js.Func, error)

OnError Set onError Handler

func (WebSocket) OnMessage

func (w WebSocket) OnMessage(handler func(m messageevent.MessageEvent)) (js.Func, error)

OnError Set onError Handler

func (WebSocket) OnOpen

func (w WebSocket) OnOpen(handler func(e event.Event)) (js.Func, error)

OnOpen Set onOpen Handler

func (WebSocket) Protocol

func (w WebSocket) Protocol() (string, error)

func (WebSocket) ReadyState

func (w WebSocket) ReadyState() (int, error)

func (WebSocket) Send

func (w WebSocket) Send(data interface{}) error

func (WebSocket) SetBinaryType

func (w WebSocket) SetBinaryType(binaryType string) error

func (WebSocket) SetOnClose

func (w WebSocket) SetOnClose(handler func(e event.Event))

SetOnClose Set onClose Handler

func (WebSocket) SetOnError

func (w WebSocket) SetOnError(handler func(e event.Event))

SetOnClose Set onClose Handler

func (WebSocket) SetOnMessage

func (w WebSocket) SetOnMessage(handler func(e messageevent.MessageEvent))

SetOnClose Set onClose Handler

func (WebSocket) SetOnOpen

func (w WebSocket) SetOnOpen(handler func(e event.Event))

SetOnOpen Set onOpen Handler

func (WebSocket) Url

func (w WebSocket) Url() (string, error)

func (WebSocket) WebSocket_

func (w WebSocket) WebSocket_() WebSocket

type WebSocketFrom

type WebSocketFrom interface {
	WebSocket_() WebSocket
}

Jump to

Keyboard shortcuts

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