websockets

package
v0.12.30 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: LGPL-3.0, LGPL-3.0 Imports: 20 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ws *websocket.Conn, server *Server) (*Client, error)

Create new chat client.

func (*Client) Close added in v0.11.4

func (c *Client) Close()

func (*Client) Conn

func (c *Client) Conn() *websocket.Conn

func (*Client) Done

func (c *Client) Done()

func (*Client) Listen

func (c *Client) Listen()

Listen Write and Read request via chanel

func (*Client) Write

func (c *Client) Write(msg resource.WsOutMessage)

type Message

type Message map[string]interface{}

type PubSubEntry added in v0.11.4

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

PubSubEntry tracks a subscription and its cancel function

type Server

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

Chat server.

func NewServer

func NewServer(pattern string, dtopicMap *map[string]*olric.PubSub, cruds map[string]*resource.DbResource, sharedPubSub *olric.PubSub) *Server

Create new chat server.

func (*Server) Add

func (s *Server) Add(c *Client)

func (*Server) Del

func (s *Server) Del(c *Client)

func (*Server) Done

func (s *Server) Done()

func (*Server) Err

func (s *Server) Err(err error)

func (*Server) Listen

func (s *Server) Listen(router *gin.Engine)

Listen and serve. It serves client connection and broadcast request.

type WebSocketConnectionHandler

type WebSocketConnectionHandler interface {
	MessageFromClient(message WebSocketPayload, client *Client)
	Close()
}

type WebSocketConnectionHandlerImpl added in v0.9.9

type WebSocketConnectionHandlerImpl struct {
	DtopicMap *map[string]*olric.PubSub
	// contains filtered or unexported fields
}

WebSocketConnectionHandlerImpl : Each websocket connection has its own handler

func (*WebSocketConnectionHandlerImpl) Close added in v0.11.4

func (wsch *WebSocketConnectionHandlerImpl) Close()

func (*WebSocketConnectionHandlerImpl) MessageFromClient added in v0.9.9

func (wsch *WebSocketConnectionHandlerImpl) MessageFromClient(message WebSocketPayload, client *Client)

type WebSocketPayload

type WebSocketPayload struct {
	Id      string  `json:"id,omitempty"`
	Method  string  `json:"method"`
	Payload Message `json:"attributes"`
}

Jump to

Keyboard shortcuts

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