Version: v0.0.0-...-5385bce Latest Latest

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 8 Imported by: 1




This section is empty.


This section is empty.


func UpgradeToWebsocket

func UpgradeToWebsocket(manager *Manager) func(ctx echo.Context) error

UpgradeToWebsocket upgrades a connection to a websocket and creates a client for the connection


type Client

type Client struct {
	// contains filtered or unexported fields

A Client manages a specific websocket connection to a client

type EventHandler

type EventHandler interface {
	// OnClientConnect is called once each time a new client is connected.
	// use sendToClient to send events to the new client.
	OnClientConnect(sendToClient chan events.Event)

	// OnEventReceived will be called each time _any_ client sends an event.
	// event is the event recieved, and events can be sent back to _all_ clients using sendToAll.
	OnEventReceived(event events.Event, sendToAll chan events.Event)

An EventHandler is a struct that handles websocket events

type Manager

type Manager struct {
	// contains filtered or unexported fields

A Manager manages a group of websocket connections

func NewManager

func NewManager() *Manager

NewManager returns new manager.

func (*Manager) SetEventHandler

func (m *Manager) SetEventHandler(handler EventHandler)

SetEventHandler sets the event handler for the websocket manager

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL