ws

package
v0.0.0-...-dc382cb Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConversationIsNotExist  = errors.New("conversations is not exist")
	ErrUserIsNotInConversation = errors.New("message sender is not in conversations")
)

Functions

func Listen

func Listen(addr string)

Listen listens to a tcp socket and upgrade tcp connection to WebSocket.

Types

type CancelWrite

type CancelWrite func()

func CancelableWrite

func CancelableWrite(conn *Conn) CancelWrite

type Client

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

func (*Client) AddConn

func (c *Client) AddConn(rwc net.Conn) (*Conn, CancelWrite, error)

func (*Client) Broadcast

func (c *Client) Broadcast(method data.ResponseMethod, data interface{})

func (*Client) RemoveConn

func (c *Client) RemoveConn(id int)

type ClientHub

type ClientHub struct {
	// contains filtered or unexported fields
}
var Hub *ClientHub

func (*ClientHub) GetClient

func (h *ClientHub) GetClient(id int64) *Client

type Conn

type Conn struct {
	ID int
	// contains filtered or unexported fields
}

func (*Conn) Output

func (c *Conn) Output(method data.ResponseMethod, obj interface{})

func (*Conn) Read

func (c *Conn) Read() error

func (*Conn) Write

func (c *Conn) Write(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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