ws_protocol

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionHandler

func OptionHandler(c echo.Context) error

func OriginMiddlewareFunc

func OriginMiddlewareFunc(next echo.HandlerFunc) echo.HandlerFunc

Types

type WsConnection

type WsConnection struct {
	Conn  *websocket.Conn
	Mutex sync.Mutex
	protocol.Connection
}

func NewWsConnection

func NewWsConnection(conn *websocket.Conn) *WsConnection

func (*WsConnection) Addr

func (this *WsConnection) Addr() string

func (*WsConnection) Close

func (this *WsConnection) Close() error

func (*WsConnection) ReadMsg

func (this *WsConnection) ReadMsg() ([]byte, error)

func (*WsConnection) WriteMsg

func (this *WsConnection) WriteMsg(data []byte) error

WriteMsg send byte array message

type WsProtocol

type WsProtocol struct {
}

func (*WsProtocol) Dial

func (this *WsProtocol) Dial(addr string) (protocol.Connection, error)

func (*WsProtocol) ListenAndServe

func (this *WsProtocol) ListenAndServe(port int64, onConnect func(conn protocol.Connection)) error

Jump to

Keyboard shortcuts

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