ws

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MotherShip

type MotherShip struct {
	Connections map[*websocket.Conn]bool
	Logger      zerolog.Logger
	Inbox       chan Msg
	Outbox      chan Msg
}

MotherShip contains pointers to all connections, and handles websockets

func NewMotherShip

func NewMotherShip() *MotherShip

a constructor, just in case

func (*MotherShip) ServeHTTP

func (m *MotherShip) ServeHTTP(w http.ResponseWriter, r *http.Request)

our main http.Handler, mounted to "/ws" probably

type Msg

type Msg struct {
	MsgType string `json:"msgType"`
	Msg     string `json:"msg,omitempty"`
	N       int    `json:"n,omitempty"`
}

Jump to

Keyboard shortcuts

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