ws

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 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 {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) Close

func (w *Client) Close() error

Close 关闭 WebSocket 连接

func (*Client) Dial

func (w *Client) Dial(url, protocol, origin string) error

func (*Client) Write

func (w *Client) Write(p []byte) (n int, err error)

Write 实现 io.Writer 接口

type Server

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

Server 是一个简单的WebSocket服务器,接收base64编码的消息并调用处理函数

func NewServer

func NewServer(addr string, handler func(conn *websocket.Conn)) *Server

NewServer 创建一个新的WebSocket服务器实例

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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