publisher

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(port int32) error

Types

type Client

type Client interface {
	HandleMessage(ctx context.Context, msg funcie.Message) error
	Close() error
}

type ClientListener

type ClientListener interface {
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

func NewWebsocketClientListener

func NewWebsocketClientListener(websocketServer WebsocketServer, clientManager ClientManager) ClientListener

type ClientManager

type ClientManager interface {
	AddClient(conn Client)
	CloseAllClients()
	AddClientRouting(id string, conn Client)
	RemoveClientRouting(id string)
	GetClientRouting(id string) (Client, error)
	Process(ctx context.Context, conn Websocket)
}

type Publisher

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

type Websocket

type Websocket interface {
	Close(code ws.StatusCode, reason string) error
	Read(ctx context.Context) (ws.MessageType, []byte, error)
	Write(ctx context.Context, typ ws.MessageType, p []byte) error
	Subprotocol() string
}

type WebsocketClientConnection

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

func NewWebsocketClient

func NewWebsocketClient(conn Websocket) *WebsocketClientConnection

func (*WebsocketClientConnection) Close

func (c *WebsocketClientConnection) Close() error

func (*WebsocketClientConnection) HandleMessage

func (c *WebsocketClientConnection) HandleMessage(ctx context.Context, msg funcie.Message) error

type WebsocketClientListener

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

func (WebsocketClientListener) ServeHTTP

type WebsocketClientManager

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

func NewWebsocketClientManager

func NewWebsocketClientManager() *WebsocketClientManager

func (*WebsocketClientManager) AddClient

func (c *WebsocketClientManager) AddClient(conn Client)

func (*WebsocketClientManager) AddClientRouting

func (c *WebsocketClientManager) AddClientRouting(id string, conn Client)

func (*WebsocketClientManager) CloseAllClients

func (c *WebsocketClientManager) CloseAllClients()

func (*WebsocketClientManager) GetClientRouting

func (c *WebsocketClientManager) GetClientRouting(id string) (Client, error)

func (*WebsocketClientManager) Process

func (c *WebsocketClientManager) Process(ctx context.Context, conn Websocket)

RegisterClient waits for a subscribe message from the client (required) and then registers a client to the client manager.

func (*WebsocketClientManager) RemoveClientRouting

func (c *WebsocketClientManager) RemoveClientRouting(id string)

type WebsocketServer

type WebsocketServer interface {
	Accept(w http.ResponseWriter, r *http.Request, opts *ws.AcceptOptions) (Websocket, error)
}

type WebsocketServerWrapper

type WebsocketServerWrapper struct{}

func (*WebsocketServerWrapper) Accept

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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