websocket

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConnectionIndex = make(map[string]map[string]string, 0)
View Source
var ConnectionPool = make(map[string]*websocket.Conn, 0)

Functions

func OnNativeMessage

func OnNativeMessage(nsConn *websocket.NSConn, msg websocket.Message) error

* 处理接收的消息

func SendRaw

func SendRaw(id string, data []byte)

func Set

func Set(app *iris.Application)

func SetSocket

func SetSocket(app *iris.Application)

* 整合socket.io和iris,也就是使用iris作为socket.io的服务器实现

Types

type WebsocketConnPool

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

func GetWebsocketConnPool

func GetWebsocketConnPool() *WebsocketConnPool

func (*WebsocketConnPool) Connect

func (this *WebsocketConnPool) Connect(conn *websocket.Conn)

func (*WebsocketConnPool) Disconnect

func (this *WebsocketConnPool) Disconnect(connectSessionId string)

func (*WebsocketConnPool) GetRemoteConn

func (this *WebsocketConnPool) GetRemoteConn(connectSessionId string) *websocket.Conn

type WsClient

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

func NewWsClient

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

构造函数

func (*WsClient) Connect

func (this *WsClient) Connect(ip string, port string, path string, timeout time.Duration)

func (*WsClient) Disconnect

func (this *WsClient) Disconnect()

func (*WsClient) OnClientNativeMessage

func (this *WsClient) OnClientNativeMessage(nsConn *websocket.NSConn, msg websocket.Message) error

* 处理接收的消息

func (*WsClient) Send

func (this *WsClient) Send(msg websocket.Message)

Jump to

Keyboard shortcuts

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