websocket

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastMessage

type BroadcastMessage interface {
	GetType() types.MessageType
}

BroadcastMessage is a message that can be broadcast to websocket clients

type Client

type Client struct {
	ID    string
	Conn  *websocket.Conn
	Pool  *Pool
	Mutex sync.Mutex
}

func (*Client) Read

func (c *Client) Read()

Read listens for new messages being sent to the websocket connection

type Message

type Message struct {
	Type int         `json:"type"`
	Body interface{} `json:"body"`
}

type Pool

type Pool struct {
	Register   chan *Client
	Unregister chan *Client
	Clients    map[*Client]bool
	Broadcast  chan BroadcastMessage
}

func NewPool

func NewPool() *Pool

func (*Pool) Start

func (pool *Pool) Start()

Jump to

Keyboard shortcuts

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