ws

package
v1.23.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Upgrader = websocket.Upgrader{
	CheckOrigin: func(r *http.Request) bool {
		return true
	},
}

Functions

This section is empty.

Types

type StreamHandler

type StreamHandler struct {
	WsConn      *WsConnection
	ResizeEvent chan *remotecommand.TerminalSize
}

func (*StreamHandler) Next

func (handler *StreamHandler) Next() (size *remotecommand.TerminalSize)

Next must return nil if the connection closed

func (*StreamHandler) Read

func (handler *StreamHandler) Read(p []byte) (size int, err error)

func (*StreamHandler) Write

func (handler *StreamHandler) Write(p []byte) (size int, err error)

type WsConnection

type WsConnection struct {
	OnClose func()
	// contains filtered or unexported fields
}

func InitWebsocket

func InitWebsocket(resp http.ResponseWriter, req *http.Request) (*WsConnection, error)

func (*WsConnection) WsClose

func (wsConn *WsConnection) WsClose()

func (*WsConnection) WsRead

func (wsConn *WsConnection) WsRead() (msg *WsMessage, err error)

func (*WsConnection) WsWrite

func (wsConn *WsConnection) WsWrite(messageType int, data []byte) (err error)

type WsMessage

type WsMessage struct {
	MessageType int
	Data        []byte
}

Jump to

Keyboard shortcuts

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