socket

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Ws   *websocket.Conn
	Send chan []byte
}

type DTOMessage

type DTOMessage struct {
	Type string
	Data interface{}
}

type Registry

type Registry struct {
	Register   chan *Socket
	Unregister chan *Socket
	Sockets    *sync.Map
}

func BuildAndRunSocketRegistry

func BuildAndRunSocketRegistry(registerHandler, unregisterHandler func(s *Socket)) *Registry

type Socket

type Socket struct {
	ErrorLogger errorlogger.ErrorLogger
	Connection  *Connection
	ID          string
}

func (*Socket) Emit

func (s *Socket) Emit(dto *DTOMessage)

func (*Socket) ReadPump

func (s *Socket) ReadPump(registry *Registry, readMessageHandler func(dto *DTOMessage))

func (*Socket) WritePump

func (s *Socket) WritePump()

Jump to

Keyboard shortcuts

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