websocket

package
v0.0.0-...-508c5de Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: LGPL-2.1-or-later Imports: 6 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 *ws.Conn, server *Server) *Client

Create new chat client.

func (*Client) Conn

func (c *Client) Conn() *ws.Conn

func (*Client) Done

func (c *Client) Done()

func (*Client) Id

func (c *Client) Id() int

func (*Client) Listen

func (c *Client) Listen()

Listen Write and Read request via chanel

func (*Client) Write

func (c *Client) Write(data interface{}, seed int)

type Message

type Message struct {
	Call string        `json:"call"`
	Args []interface{} `json:"args"`
	Seed int           `json:"seed"`
	Data interface{}   `json:"data"`
}

func (*Message) Arguments

func (self *Message) Arguments() *ethutil.Value

type MsgFunc

type MsgFunc func(c *Client, msg *Message)

type Server

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

Chat server.

func NewServer

func NewServer(pattern, httpServ 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) MessageFunc

func (s *Server) MessageFunc(f MsgFunc)

func (*Server) SendAll

func (s *Server) SendAll(msg string)

Jump to

Keyboard shortcuts

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