transports

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POLLING      string = "polling"
	WEBSOCKET    string = "websocket"
	WEBTRANSPORT string = "webtransport"
)

Variables

This section is empty.

Functions

func Transports

func Transports() map[string]*transports

Types

type Jsonp

type Jsonp interface {
	Polling
}

func MakeJSONP

func MakeJSONP() Jsonp

JSON-P polling transport.

func NewJSONP

func NewJSONP(ctx *types.HttpContext) Jsonp

type Polling

type Polling interface {
	Transport

	// #methods
	SetReq(*types.HttpContext)

	// @protected
	Req() *types.HttpContext

	DoWrite(*types.HttpContext, _types.BufferInterface, *packet.Options, func(*types.HttpContext))
}

func MakePolling

func MakePolling() Polling

HTTP polling New.

func NewPolling

func NewPolling(ctx *types.HttpContext) Polling

type Transport

type Transport interface {
	events.EventEmitter

	Prototype(Transport)
	Proto() Transport

	SetSid(string)
	SetWritable(bool)

	SetSupportsBinary(bool)
	SetReadyState(string)
	SetHttpCompression(*types.HttpCompression)
	SetPerMessageDeflate(*types.PerMessageDeflate)
	SetMaxHttpBufferSize(int64)

	// The session ID.
	Sid() string
	// Whether the transport is currently ready to send packets.
	Writable() bool
	// The revision of the protocol:
	//
	// - 3 is used in Engine.IO v3 / Socket.IO v2
	// - 4 is used in Engine.IO v4 and above / Socket.IO v3 and above
	//
	// It is found in the `EIO` query parameters of the HTTP requests.
	//
	// @see https://github.com/socketio/engine.io-protocol
	Protocol() int
	// Whether the transport is discarded and can be safely closed (used during upgrade).
	//
	// @protected
	Discarded() bool
	// The parser to use (depends on the revision of the {@link Transport#protocol}.
	//
	// @protected
	Parser() parser.Parser
	// Whether the transport supports binary payloads (else it will be base64-encoded)
	//
	// @protected
	SupportsBinary() bool
	// The current state of the transport.
	//
	// @protected
	ReadyState() string
	HttpCompression() *types.HttpCompression
	PerMessageDeflate() *types.PerMessageDeflate
	MaxHttpBufferSize() int64
	// @abstract
	HandlesUpgrades() bool
	// @abstract
	Name() string

	// Construct() should be called after calling Prototype()
	Construct(*types.HttpContext)
	// @private
	// Flags the transport as discarded.
	Discard()
	// @protected
	// Called with an incoming HTTP request.
	OnRequest(*types.HttpContext)
	// @private
	// Closes the transport.
	Close(...types.Callable)
	// @protected
	// Called with a transport error.
	OnError(string, error)
	// @protected
	// Called with parsed out a packets from the data stream.
	OnPacket(*packet.Packet)
	// @protected
	// Called with the encoded packet data.
	OnData(_types.BufferInterface)
	// @protected
	// Called upon transport close.
	OnClose()
	// @protected
	// @abstract
	// Writes a packet payload.
	Send([]*packet.Packet)
	// @protected
	// @abstract
	// Closes the transport.
	DoClose(types.Callable)
}

func MakeTransport

func MakeTransport() Transport

func NewTransport

func NewTransport(ctx *types.HttpContext) Transport

type WebTransport

type WebTransport interface {
	Transport
}

func MakeWebTransport

func MakeWebTransport() WebTransport

WebTransport transport

func NewWebTransport

func NewWebTransport(ctx *types.HttpContext) WebTransport

type Websocket

type Websocket interface {
	Transport
}

func MakeWebSocket

func MakeWebSocket() Websocket

WebSocket transport

func NewWebSocket

func NewWebSocket(ctx *types.HttpContext) Websocket

Jump to

Keyboard shortcuts

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