websockets

package
v0.9.82 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: LGPL-3.0 Imports: 10 Imported by: 2

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) 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.EventMessage)

type Message

type Message map[string]interface{}

type Server

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

Chat server.

func NewServer

func NewServer(pattern string, dtopicMap *map[string]*olric.DTopic, cruds map[string]*resource.DbResource) *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)
}

type WebSocketConnectionHandlerImpl added in v0.9.9

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

WebSocketConnectionHandlerImpl : Each websocket connection has its own handler

func (*WebSocketConnectionHandlerImpl) MessageFromClient added in v0.9.9

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

type WebSocketPayload

type WebSocketPayload struct {
	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