ws

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WsAssets

func WsAssets() string

Types

type Client

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

Client is a middleman between the websocket connection and the hub.

type WebSocketHub

type WebSocketHub struct {

	// Time to wait for a write to complete
	WriteWait time.Duration

	// Time allowed to read the next pong message from the peer.
	PongWait time.Duration

	// Send pings to peer with this period. Must be less than pongWait.
	PingPeriod time.Duration

	// Maximum message size allowed from peer.
	MaxMessageSize int64
	// contains filtered or unexported fields
}

func NewWebSocketHub

func NewWebSocketHub() *WebSocketHub

type WsMessenger

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

func (*WsMessenger) JavascriptFiles

func (m *WsMessenger) JavascriptFiles() map[string]html.Attributes

func (*WsMessenger) JavascriptInit

func (m *WsMessenger) JavascriptInit() string

func (*WsMessenger) Send

func (m *WsMessenger) Send(channel string, message string)

func (*WsMessenger) Start

func (m *WsMessenger) Start() *WebSocketHub

func (*WsMessenger) WebSocketHandler added in v0.14.0

func (m *WsMessenger) WebSocketHandler() http.Handler

WebSocketHandler handles web socket requests to send messages to clients. It gets the client id from the context in the request. You should intercept the request, authorize the client, then insert the client ID into the context of the Request

Jump to

Keyboard shortcuts

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