ws

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommonChanCount = 1000
)

Variables

View Source
var (
	ErrConnClosed = errors.New("connection is closed")
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	SocketId string
	// contains filtered or unexported fields
}

TODO: 实现 gorilla/websocket 的事件监听,适配 socketio socketio 数据传输格式: `["binding","{\"code\":0,\"data\":123456,\"message\":\"\"}"]` // 字符串数组,第一个字符串是事件名,第二个字符串是数据,通常是 json string ["",""]

func InitConn

func InitConn(wsConn *websocket.Conn) (conn *Conn, err error)

func (*Conn) Close

func (c *Conn) Close()

func (*Conn) ReadMessage

func (c *Conn) ReadMessage() (data []byte, err error)

func (*Conn) WriteJson

func (c *Conn) WriteJson(data any) (err error)

func (*Conn) WriteMessage

func (c *Conn) WriteMessage(data []byte) (err error)

Jump to

Keyboard shortcuts

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