wsocket

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 9 Imported by: 0

README

wsocket

una implementación del protocolo WebSocket un poco diferente escrita en Go

para uso general chat o x sistema. en la carpeta test hay un ejemplo de su uso.

saludos# wsocket

wsocket

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryHandler added in v0.0.3

type BinaryHandler interface {
	BinaryHandler(data_in []byte, out chan<- *model.Request)
}

type WebSocket

type WebSocket struct {

	//canal de entrada nuevas solicitudes.
	REQUESTS_IN chan *model.Request

	// canal salida de solicitudes
	REQUESTS_OUT chan *model.Request

	// canal que avisa el cierre de las conexiones
	CLOSED_CONNECTION chan *model.User

	*cutkey.Cut
	// contains filtered or unexported fields
}

concentrador de solicitantes para websocket

func New

func New(models []model.Object, buffer_size, concurrency_max int, allowed_origins ...string) *WebSocket

models mapa con los modelos de objetos que utiliza el sistema allowed_origins ej: "http://localhost", "http://127.0.0.1", "http://example.com", "https://example.com" buffer_size ej: 1024 concurrency_max Limitar la concurrencia de conexiones simultáneas ej 100

func (*WebSocket) ServeHTTP

func (h *WebSocket) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*WebSocket) StartBroadcasting

func (h *WebSocket) StartBroadcasting(in <-chan *model.Request)

func (*WebSocket) UserAdd

func (h *WebSocket) UserAdd(users ...*model.User)

func (*WebSocket) UserRemove

func (hub *WebSocket) UserRemove(a *model.User)

Jump to

Keyboard shortcuts

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