websocket

package
v0.0.0-...-722f3ca Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package websocket implements a websocket reader/writer. The implementation heavily based on the VW Video Streaming server (https://github.com/timdrysdale/vw).

The code was originally taken on 2022-03-24 from the below address https://github.com/timdrysdale/vw/blob/6dbe6d197ddaf1578edbfb969a73c7ec45d29e98/cmd/handleWs.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller defines a websocket controller for managing websocket connections

func NewController

func NewController(msgChan chan []byte) *Controller

NewController will initialise a new instance

func (*Controller) ForwardMessages

func (c *Controller) ForwardMessages()

ForwardMessages will iterate messages and send them to connected clients

func (*Controller) HandleWs

func (c *Controller) HandleWs(w http.ResponseWriter, r *http.Request)

HandleWs handles a websocket connection and records a client instance

type WsHandlerClient

type WsHandlerClient struct {
	Messages   chan []byte
	Conn       *websocket.Conn
	UserAgent  string // r.UserAgent()
	RemoteAddr string // r.Header.Get("X-Forwarded-For")
	ID         string
	ChunkCount int
}

WsHandlerClient defines a client connection and message transfer

Jump to

Keyboard shortcuts

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