wsclient

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderSize            = 8
	ProtectLongPacketSize = 4 * 1024 * 1024
)
View Source
const (
	TimeOut = time.Second * 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WebSocket

type WebSocket struct {
	*websocket.Conn
	// contains filtered or unexported fields
}

func NewWebSocket

func NewWebSocket(url string, client *WsClient) (*WebSocket, error)

func (*WebSocket) Close

func (this *WebSocket) Close() *promise.Promise

func (*WebSocket) ServeIO

func (this *WebSocket) ServeIO()

type WsClient

type WsClient struct {
	events.EventEmmiter

	Closing bool
	Opening bool
	// contains filtered or unexported fields
}

func NewWsClient

func NewWsClient() *WsClient

func (*WsClient) AsyncCall

func (this *WsClient) AsyncCall(transId uint32, req interface{}) (interface{}, error)

func (*WsClient) Call

func (this *WsClient) Call(transId uint32, req interface{}) (interface{}, error)

func (*WsClient) ClearContext

func (this *WsClient) ClearContext()

func (*WsClient) Close

func (this *WsClient) Close() *promise.Promise

func (*WsClient) Connect

func (this *WsClient) Connect(addr string) *promise.Promise

func (*WsClient) Connected

func (this *WsClient) Connected() bool

func (*WsClient) Disconnect

func (this *WsClient) Disconnect(force bool) *promise.Promise

func (*WsClient) HookRecv

func (this *WsClient) HookRecv(data []byte) (interface{}, error)

func (*WsClient) Off

func (this *WsClient) Off(cmdId uint16, listener events.Listener)

func (*WsClient) OnClose

func (this *WsClient) OnClose(conn *websocket.Conn)

func (*WsClient) OnMessage

func (this *WsClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)

func (*WsClient) OnOpen

func (this *WsClient) OnOpen(conn *websocket.Conn)

func (*WsClient) OnRecv

func (this *WsClient) OnRecv(connect lokas.IConn, data []byte)

func (*WsClient) OnRecvCmd

func (this *WsClient) OnRecvCmd(cmdId protocol.BINARY_TAG, time time.Duration) *promise.Promise

func (*WsClient) OnRecvData

func (this *WsClient) OnRecvData(data []byte)

func (*WsClient) OnRecvMessage

func (this *WsClient) OnRecvMessage(cmdId protocol.BINARY_TAG, transId uint32, msg interface{})

func (*WsClient) Open

func (this *WsClient) Open() *promise.Promise

func (*WsClient) Request

func (this *WsClient) Request(req interface{}) *promise.Promise

func (*WsClient) Run

func (this *WsClient) Run()

func (*WsClient) SendMessage

func (this *WsClient) SendMessage(transId uint32, msg interface{})

Jump to

Keyboard shortcuts

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