ws_server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Port int    // 运行端口
	Url  string // 运行的连接地址
	// contains filtered or unexported fields
}

func NewServer

func NewServer(port int, url string) *Server

func (*Server) Close

func (s *Server) Close(conn *websocket.Conn)

Close 服务端主动关闭某个客户端

func (*Server) On

func (s *Server) On(event string, f func(conn *websocket.Conn, data []byte))

func (*Server) Run

func (s *Server) Run()

func (*Server) Send

func (s *Server) Send(conn *websocket.Conn, data []byte) error

Send 服务端主动向客户端发送消息

func (*Server) SendToClient added in v1.0.1

func (s *Server) SendToClient(client string, content []byte)

SendToClient 向客户端所有的conn发送消息

Jump to

Keyboard shortcuts

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