chat

package
v0.0.0-...-f40d0ba Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Id     string
	Socket *websocket.Conn
	Send   chan []byte
	// contains filtered or unexported fields
}

func (*Client) Read

func (c *Client) Read()

func (*Client) Write

func (c *Client) Write()

type ClientManager

type ClientManager struct {
	Clients    map[*Client]bool
	Broadcast  chan []byte
	Register   chan *Client
	Unregister chan *Client
}

func NewClientManager

func NewClientManager() *ClientManager

func (*ClientManager) Handler

func (o *ClientManager) Handler(res http.ResponseWriter, req *http.Request)

func (*ClientManager) NewClient

func (o *ClientManager) NewClient(conn *websocket.Conn) *Client

func (*ClientManager) Send

func (o *ClientManager) Send(message []byte, ignore *Client)

func (*ClientManager) Start

func (o *ClientManager) Start()

type Message

type Message struct {
	Sender    string `json:"sender,omitempty"`
	Recipient string `json:"recipient,omitempty"`
	Content   string `json:"content,omitempty"`
}

Jump to

Keyboard shortcuts

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