wswrap

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GWsConn

type GWsConn struct {
	Ws *websocket.Conn

	UserData interface{} //给上层使用,可以继连接绑定数据

	Isreconnect bool //是否重连
	// contains filtered or unexported fields
}

func NewConn

func NewConn(w http.ResponseWriter, r *http.Request) (*GWsConn, error)

NewConn 生成连接

func (*GWsConn) Close

func (c *GWsConn) Close() error

func (*GWsConn) GetID

func (c *GWsConn) GetID() string

GetID 获得ID

func (*GWsConn) Local

func (c *GWsConn) Local() string

func (*GWsConn) Remote

func (c *GWsConn) Remote() string

func (*GWsConn) Rev

func (c *GWsConn) Rev(*transport.Message) error

func (*GWsConn) Send

func (c *GWsConn) Send(m *transport.Message) error

func (*GWsConn) SendBytes

func (c *GWsConn) SendBytes(data []byte) error

SendBytes 发送二进制数据†

func (*GWsConn) SendKick

func (c *GWsConn) SendKick(kickcode int) error

SendKick 发送踢下线消息

func (*GWsConn) SendProto

func (c *GWsConn) SendProto(m proto.Message) error

SendProto 发送proto

func (*GWsConn) SendText

func (c *GWsConn) SendText(data []byte) error

SendText 发送文本数据

type IWswrap

type IWswrap interface {
	Init() error
}

Jump to

Keyboard shortcuts

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