stdhttp

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WebsocketConnectionPool = make(map[string]*WebsocketConnection)

WebsocketConnectionPool connectsessionId与websocketconnection的映射

Functions

func NewWsClient

func NewWsClient(schema string, ip string, port string, path string, timeout time.Duration) *client

构造函数

func RegistDisconnectedHandler

func RegistDisconnectedHandler(handler func(connectSessionId string))

func RegistMessageHandler

func RegistMessageHandler(handler func(data []byte, remotePeerId string, clientId string, connectSessionId string, remoteAddr string) ([]byte, error))

* 注册读取原生数据的处理器

func SendRaw

func SendRaw(sessionId string, data []byte) error

* 主动发回信息,也是写入写出管道

func Start

func Start()

Types

type WebsocketConnection

type WebsocketConnection struct {
	Session   *session2.Session
	WsConnect *websocket.Conn
	// contains filtered or unexported fields
}

func (*WebsocketConnection) Close

func (conn *WebsocketConnection) Close()

func (*WebsocketConnection) Write

func (conn *WebsocketConnection) Write(messageType int, data []byte) (err error)

数据写入输出管道,然后通过无限循环的写出操作写出数据

type WebsocketMessage

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

自己实现的基于gorilla websocket的独立服务端,能够处理超大连接数

Jump to

Keyboard shortcuts

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