wsjs
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package wsjs implements typed access to the browser javascript WebSocket API.
Index¶
- type CloseEvent
- type MessageEvent
- type WebSocket
- func (c WebSocket) Close(code int, reason string) (err error)
- func (c WebSocket) OnClose(fn func(CloseEvent)) (remove func())
- func (c WebSocket) OnError(fn func(e js.Value)) (remove func())
- func (c WebSocket) OnMessage(fn func(m MessageEvent)) (remove func())
- func (c WebSocket) OnOpen(fn func(e js.Value)) (remove func())
- func (c WebSocket) SendBytes(v []byte) (err error)
- func (c WebSocket) SendText(v string) (err error)
- func (c WebSocket) Subprotocol() string
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeCloseEvent¶
CloseEvent is the type passed to a WebSocket close handler.
typeMessageEvent¶
type MessageEvent struct {// string or []byte.Data interface{}}
MessageEvent is the type passed to a message handler.
typeWebSocket¶
type WebSocket struct {// contains filtered or unexported fields}
WebSocket is a wrapper around a javascript WebSocket object.
func (WebSocket)OnClose¶
func (cWebSocket) OnClose(fn func(CloseEvent)) (remove func())
OnClose registers a function to be called when the WebSocket is closed.
func (WebSocket)OnError¶
OnError registers a function to be called when there is an errorwith the WebSocket.
func (WebSocket)OnMessage¶
func (cWebSocket) OnMessage(fn func(mMessageEvent)) (remove func())
OnMessage registers a function to be called when the WebSocket receives a message.
func (WebSocket)Subprotocol¶
Subprotocol returns the WebSocket subprotocol in use.