tinywebsocket

package module
v0.0.0-...-271d2e2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

tinywebsocket

TinyWebSocket is a lib that wraps the syscall/js api to provide a better developer experience, while being compileable by TinyGo

The API is not final, not tested and i cannot recommend it for production use. But i'm happy for issues and prs :)

Documentation

Overview

Package is mostly inspired by https://github.com/gopherjs/websocket/blob/master/websocketjs/websocketjs.go Websocket RFC: https://tools.ietf.org/html/rfc6455

Index

Constants

This section is empty.

Variables

View Source
var ErrCouldNotGetWebsocket = errors.New("could not get websocket")

Functions

This section is empty.

Types

type Websocket

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

func New

func New(url string) (*Websocket, error)

func (*Websocket) AddEventListener

func (w *Websocket) AddEventListener(name string, eventListener func(this js.Value, args []js.Value))

func (*Websocket) Close

func (w *Websocket) Close() error

func (*Websocket) OnClose

func (w *Websocket) OnClose(this js.Value, args []js.Value)

func (*Websocket) OnError

func (w *Websocket) OnError(this js.Value, args []js.Value)

func (*Websocket) OnOpen

func (w *Websocket) OnOpen(this js.Value, args []js.Value)

func (*Websocket) Open

func (w *Websocket) Open()

func (*Websocket) Read

func (w *Websocket) Read(b []byte) (n int, err error)

func (*Websocket) RemoveEventListener

func (w *Websocket) RemoveEventListener(name string, eventListener func(this js.Value, args []js.Value))

func (*Websocket) Send

func (w *Websocket) Send(data interface{})

func (*Websocket) Write

func (w *Websocket) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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