jkws

package
v0.0.0-...-a9e9222 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMWSHandler

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

CMWSHandler base of weboscket handler

func NewCMWSHandler

func NewCMWSHandler(addr string, port int) (*CMWSHandler, error)

NewCMWSHandler create one cmwshandler

func (*CMWSHandler) Add

func (ws *CMWSHandler) Add(url string, msgDeal func(*websocket.Conn))

Add pair of url and handler function

func (*CMWSHandler) Read

func (ws *CMWSHandler) Read(wc *websocket.Conn, data []byte) (int, error)

Read read message

func (*CMWSHandler) Start

func (ws *CMWSHandler) Start() error

Start start to listen on special port

func (*CMWSHandler) StartTls

func (ws *CMWSHandler) StartTls(permfile, keyfile string) error

func (*CMWSHandler) Write

func (ws *CMWSHandler) Write(wc *websocket.Conn, data []byte) (int, error)

Write write message to special socket wc

type CMWSHandlerClient

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

CMWSHandlerClient handler

func NewWSHandlerClient

func NewWSHandlerClient(addr string, port int, secure bool, baseurl string) (*CMWSHandlerClient, error)

NewWSHandlerClient create ws handler client

func (*CMWSHandlerClient) Close

func (ws *CMWSHandlerClient) Close()

Close close handler

func (*CMWSHandlerClient) Connect

func (ws *CMWSHandlerClient) Connect(retry int) error

Connect retry count (interval 1 second)

func (*CMWSHandlerClient) ConnectTls

func (ws *CMWSHandlerClient) ConnectTls(retry int) error

func (*CMWSHandlerClient) Recv

func (ws *CMWSHandlerClient) Recv(msg []byte) (int, error)

Recv recv data

func (*CMWSHandlerClient) Send

func (ws *CMWSHandlerClient) Send(msg []byte, recv bool) (int, error)

Send send data, @recv if recv response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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