Help us shape the future of Go! Take the 2026 Go Developer Survey

socket

package
v1.3.103 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: GPL-3.0 Imports: 8 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 EventHandlers added in v0.5.5

type EventHandlers struct {
	RegisterHandler, UnregisterHandler func(s *Socket)
}

type NamespaceEventHandlerMap added in v0.5.5

type NamespaceEventHandlerMap map[string]*EventHandlers

type Registry

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

func NewSocketRegistry added in v0.8.78

func NewSocketRegistry(eventHandlersMap NamespaceEventHandlerMap, serviceGoroutine goroutine.IGoroutine) *Registry

type Socket

type Socket struct {
	Ctx         context.Context
	ErrorLogger errorlogger.ErrorLogger
	Connection  *Connection
	ID          string
	Namespace   string
}

func (*Socket) Emit

func (s *Socket) Emit(dto interface{})

func (*Socket) ReadPump

func (s *Socket) ReadPump(registry *Registry, readMessageHandler func(rawData []byte))

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