chat

package
v0.0.0-...-f53f79a Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: MIT Imports: 5 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 {
	// contains filtered or unexported fields
}

Chat client.

func NewClient

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

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 *Message)

type Message

type Message struct {
	Author string `json:"author"`
	Body   string `json:"body"`
}

func (*Message) String

func (self *Message) String() string

type Server

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

Chat server.

func NewServer

func NewServer(pattern string) *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()

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

func (*Server) SendAll

func (s *Server) SendAll(msg *Message)

Jump to

Keyboard shortcuts

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