transport

package
v0.0.0-...-3a7d5fb Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	WsDefaultPingInterval   = 30 * time.Second
	WsDefaultPingTimeout    = 60 * time.Second
	WsDefaultReceiveTimeout = 60 * time.Second
	WsDefaultSendTimeout    = 60 * time.Second
	WsDefaultBufferSize     = 1024 * 32
)

Variables

View Source
var (
	ErrorBinaryMessage     = errors.New("Binary messages are not supported")
	ErrorBadBuffer         = errors.New("Buffer error")
	ErrorPacketWrong       = errors.New("Wrong packet type error")
	ErrorMethodNotAllowed  = errors.New("Method not allowed")
	ErrorHttpUpgradeFailed = errors.New("Http upgrade failed")
)

Functions

This section is empty.

Types

type WebsocketConnection

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

func (*WebsocketConnection) Close

func (wsc *WebsocketConnection) Close()

func (*WebsocketConnection) GetMessage

func (wsc *WebsocketConnection) GetMessage() (message string, err error)

func (*WebsocketConnection) PingParams

func (wsc *WebsocketConnection) PingParams() (interval, timeout time.Duration)

func (*WebsocketConnection) WriteMessage

func (wsc *WebsocketConnection) WriteMessage(message string) error

type WebsocketTransport

type WebsocketTransport struct {
	PingInterval   time.Duration
	PingTimeout    time.Duration
	ReceiveTimeout time.Duration
	SendTimeout    time.Duration

	BufferSize int

	RequestHeader http.Header
	// contains filtered or unexported fields
}

func GetDefaultWebsocketTransport

func GetDefaultWebsocketTransport(proxyDialer proxy.Dialer) *WebsocketTransport

* Returns websocket connection with default params

func (*WebsocketTransport) Connect

func (wst *WebsocketTransport) Connect(url string) (conn tp.Connection, err error)

func (*WebsocketTransport) HandleConnection

func (wst *WebsocketTransport) HandleConnection(
	w http.ResponseWriter, r *http.Request) (conn tp.Connection, err error)

func (*WebsocketTransport) Serve

* Websocket connection do not require any additional processing

Jump to

Keyboard shortcuts

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