transport

package
v0.0.0-...-4ea3bf1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ITransport

type ITransport interface {
	GetName() string
	Discard()
	Close()
	Recv() (packet.Packet, []byte, error)
	Send(pack packet.Packet, data []byte, force bool) bool
	//
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error

	HandleRequest(r *http.Request, w http.ResponseWriter)
}

type Polling

type Polling struct {
	*Transport
	PollingOptions PollingOptions
	// contains filtered or unexported fields
}

func NewPolling

func NewPolling(opt PollingOptions, sid string) *Polling

func (*Polling) GetName

func (p *Polling) GetName() string

func (*Polling) HandleDataRequest

func (p *Polling) HandleDataRequest(r *http.Request, w http.ResponseWriter)

func (*Polling) HandlePollRequest

func (p *Polling) HandlePollRequest(r *http.Request, w http.ResponseWriter) error

func (*Polling) HandleRequest

func (p *Polling) HandleRequest(r *http.Request, w http.ResponseWriter)

func (*Polling) SetHeaders

func (p *Polling) SetHeaders(r *http.Request, w http.ResponseWriter)

func (*Polling) SetReadDeadline

func (p *Polling) SetReadDeadline(t time.Time) error

func (*Polling) SetWriteDeadline

func (p *Polling) SetWriteDeadline(t time.Time) error

type PollingOptions

type PollingOptions struct {
	TransportOptions
	Type              PollingType
	MaxHttpBufferSize uint64
	HttpCompression   bool
}

type PollingType

type PollingType int
const (
	XHR   PollingType = 0
	JSONP PollingType = 1
)

type Transport

type Transport struct {
	SupportsBinary bool
	// contains filtered or unexported fields
}

func NewTransport

func NewTransport(opt TransportOptions) *Transport

func (*Transport) Close

func (t *Transport) Close()

func (*Transport) Discard

func (t *Transport) Discard()

func (*Transport) HandleRequest

func (t *Transport) HandleRequest(r *http.Request, w http.ResponseWriter)

func (*Transport) Recv

func (t *Transport) Recv() (packet.Packet, []byte, error)

func (*Transport) Send

func (t *Transport) Send(pack packet.Packet, data []byte, force bool) bool

type TransportOptions

type TransportOptions struct {
	SupportsBinary bool
}

type WSOptions

type WSOptions struct {
	TransportOptions
}

type Websocket

type Websocket struct {
	*Transport
	// contains filtered or unexported fields
}

func NewWebsocket

func NewWebsocket(opt WSOptions, sid string, con *websocket.Conn) *Websocket

func (*Websocket) GetName

func (ws *Websocket) GetName() string

func (*Websocket) SetReadDeadline

func (ws *Websocket) SetReadDeadline(t time.Time) error

func (*Websocket) SetWriteDeadline

func (ws *Websocket) SetWriteDeadline(t time.Time) error

Jump to

Keyboard shortcuts

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