Documentation
¶
Index ¶
Constants ¶
View Source
const ( POLLING string = "polling" WEBSOCKET string = "websocket" WEBTRANSPORT string = "webtransport" )
Variables ¶
View Source
var (
BINARY_HEADER = []byte{0x36}
)
Functions ¶
func Transports ¶
func Transports() map[string]*transports
Types ¶
type Jsonp ¶
type Jsonp interface {
Polling
}
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 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 NewWebTransport ¶
func NewWebTransport(ctx *types.HttpContext) WebTransport
type Websocket ¶
type Websocket interface {
Transport
}
func NewWebSocket ¶
func NewWebSocket(ctx *types.HttpContext) Websocket
Click to show internal directories.
Click to hide internal directories.