Documentation
¶
Overview ¶
Package config provides attach options for configuring how the Engine.IO server is attached to an HTTP server.
Package config provides configuration types and options for the Engine.IO server, including server and attach options.
Index ¶
- type AllowRequest
- type AttachOptions
- func (a *AttachOptions) AddTrailingSlash() bool
- func (a *AttachOptions) Assign(data AttachOptionsInterface) AttachOptionsInterface
- func (a *AttachOptions) DestroyUpgrade() bool
- func (a *AttachOptions) DestroyUpgradeTimeout() time.Duration
- func (a *AttachOptions) GetRawAddTrailingSlash() types.Optional[bool]
- func (a *AttachOptions) GetRawDestroyUpgrade() types.Optional[bool]
- func (a *AttachOptions) GetRawDestroyUpgradeTimeout() types.Optional[time.Duration]
- func (a *AttachOptions) GetRawPath() types.Optional[string]
- func (a *AttachOptions) Path() string
- func (a *AttachOptions) SetAddTrailingSlash(addTrailingSlash bool)
- func (a *AttachOptions) SetDestroyUpgrade(destroyUpgrade bool)
- func (a *AttachOptions) SetDestroyUpgradeTimeout(destroyUpgradeTimeout time.Duration)
- func (a *AttachOptions) SetPath(path string)
- type AttachOptionsInterface
- type Options
- type OptionsInterface
- type ServerOptions
- func (s *ServerOptions) AllowEIO3() bool
- func (s *ServerOptions) AllowRequest() AllowRequest
- func (s *ServerOptions) AllowUpgrades() bool
- func (s *ServerOptions) Assign(data ServerOptionsInterface) ServerOptionsInterface
- func (s *ServerOptions) Cookie() *http.Cookie
- func (s *ServerOptions) Cors() *types.Cors
- func (s *ServerOptions) GetRawAllowEIO3() types.Optional[bool]
- func (s *ServerOptions) GetRawAllowRequest() types.Optional[AllowRequest]
- func (s *ServerOptions) GetRawAllowUpgrades() types.Optional[bool]
- func (s *ServerOptions) GetRawCookie() types.Optional[*http.Cookie]
- func (s *ServerOptions) GetRawCors() types.Optional[*types.Cors]
- func (s *ServerOptions) GetRawHttpCompression() types.Optional[*types.HttpCompression]
- func (s *ServerOptions) GetRawInitialPacket() types.Optional[io.Reader]
- func (s *ServerOptions) GetRawMaxHttpBufferSize() types.Optional[int64]
- func (s *ServerOptions) GetRawPerMessageDeflate() types.Optional[*types.PerMessageDeflate]
- func (s *ServerOptions) GetRawPingInterval() types.Optional[time.Duration]
- func (s *ServerOptions) GetRawPingTimeout() types.Optional[time.Duration]
- func (s *ServerOptions) GetRawTransports() types.Optional[*types.Set[transports.TransportCtor]]
- func (s *ServerOptions) GetRawUpgradeTimeout() types.Optional[time.Duration]
- func (s *ServerOptions) HttpCompression() *types.HttpCompression
- func (s *ServerOptions) InitialPacket() io.Reader
- func (s *ServerOptions) MaxHttpBufferSize() int64
- func (s *ServerOptions) PerMessageDeflate() *types.PerMessageDeflate
- func (s *ServerOptions) PingInterval() time.Duration
- func (s *ServerOptions) PingTimeout() time.Duration
- func (s *ServerOptions) SetAllowEIO3(allowEIO3 bool)
- func (s *ServerOptions) SetAllowRequest(allowRequest AllowRequest)
- func (s *ServerOptions) SetAllowUpgrades(allowUpgrades bool)
- func (s *ServerOptions) SetCookie(cookie *http.Cookie)
- func (s *ServerOptions) SetCors(cors *types.Cors)
- func (s *ServerOptions) SetHttpCompression(httpCompression *types.HttpCompression)
- func (s *ServerOptions) SetInitialPacket(initialPacket io.Reader)
- func (s *ServerOptions) SetMaxHttpBufferSize(maxHttpBufferSize int64)
- func (s *ServerOptions) SetPerMessageDeflate(perMessageDeflate *types.PerMessageDeflate)
- func (s *ServerOptions) SetPingInterval(pingInterval time.Duration)
- func (s *ServerOptions) SetPingTimeout(pingTimeout time.Duration)
- func (s *ServerOptions) SetTransports(transports *types.Set[transports.TransportCtor])
- func (s *ServerOptions) SetUpgradeTimeout(upgradeTimeout time.Duration)
- func (s *ServerOptions) Transports() *types.Set[transports.TransportCtor]
- func (s *ServerOptions) UpgradeTimeout() time.Duration
- type ServerOptionsInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowRequest ¶
type AllowRequest func(*types.HttpContext) error
type AttachOptions ¶
type AttachOptions struct {
// contains filtered or unexported fields
}
func DefaultAttachOptions ¶
func DefaultAttachOptions() *AttachOptions
func (*AttachOptions) AddTrailingSlash ¶
func (a *AttachOptions) AddTrailingSlash() bool
func (*AttachOptions) Assign ¶
func (a *AttachOptions) Assign(data AttachOptionsInterface) AttachOptionsInterface
func (*AttachOptions) DestroyUpgrade ¶
func (a *AttachOptions) DestroyUpgrade() bool
func (*AttachOptions) DestroyUpgradeTimeout ¶
func (a *AttachOptions) DestroyUpgradeTimeout() time.Duration
func (*AttachOptions) GetRawAddTrailingSlash ¶
func (a *AttachOptions) GetRawAddTrailingSlash() types.Optional[bool]
func (*AttachOptions) GetRawDestroyUpgrade ¶
func (a *AttachOptions) GetRawDestroyUpgrade() types.Optional[bool]
func (*AttachOptions) GetRawDestroyUpgradeTimeout ¶
func (a *AttachOptions) GetRawDestroyUpgradeTimeout() types.Optional[time.Duration]
func (*AttachOptions) GetRawPath ¶
func (a *AttachOptions) GetRawPath() types.Optional[string]
func (*AttachOptions) Path ¶
func (a *AttachOptions) Path() string
func (*AttachOptions) SetAddTrailingSlash ¶
func (a *AttachOptions) SetAddTrailingSlash(addTrailingSlash bool)
Whether we should add a trailing slash to the request path.
func (*AttachOptions) SetDestroyUpgrade ¶
func (a *AttachOptions) SetDestroyUpgrade(destroyUpgrade bool)
destroy unhandled upgrade requests
func (*AttachOptions) SetDestroyUpgradeTimeout ¶
func (a *AttachOptions) SetDestroyUpgradeTimeout(destroyUpgradeTimeout time.Duration)
milliseconds after which unhandled requests are ended
func (*AttachOptions) SetPath ¶
func (a *AttachOptions) SetPath(path string)
name of the path to capture
type AttachOptionsInterface ¶
type AttachOptionsInterface interface {
SetPath(string)
GetRawPath() types.Optional[string]
Path() string
SetDestroyUpgrade(bool)
GetRawDestroyUpgrade() types.Optional[bool]
DestroyUpgrade() bool
SetDestroyUpgradeTimeout(time.Duration)
GetRawDestroyUpgradeTimeout() types.Optional[time.Duration]
DestroyUpgradeTimeout() time.Duration
SetAddTrailingSlash(bool)
GetRawAddTrailingSlash() types.Optional[bool]
AddTrailingSlash() bool
}
type Options ¶
type Options struct {
AttachOptions
ServerOptions
}
func DefaultOptions ¶
func DefaultOptions() *Options
func (*Options) Assign ¶
func (o *Options) Assign(data OptionsInterface) OptionsInterface
type OptionsInterface ¶
type OptionsInterface interface {
AttachOptionsInterface
ServerOptionsInterface
}
type ServerOptions ¶
type ServerOptions struct {
// contains filtered or unexported fields
}
func DefaultServerOptions ¶
func DefaultServerOptions() *ServerOptions
func (*ServerOptions) AllowEIO3 ¶
func (s *ServerOptions) AllowEIO3() bool
func (*ServerOptions) AllowRequest ¶
func (s *ServerOptions) AllowRequest() AllowRequest
func (*ServerOptions) AllowUpgrades ¶
func (s *ServerOptions) AllowUpgrades() bool
func (*ServerOptions) Assign ¶
func (s *ServerOptions) Assign(data ServerOptionsInterface) ServerOptionsInterface
func (*ServerOptions) Cookie ¶
func (s *ServerOptions) Cookie() *http.Cookie
func (*ServerOptions) Cors ¶
func (s *ServerOptions) Cors() *types.Cors
func (*ServerOptions) GetRawAllowEIO3 ¶
func (s *ServerOptions) GetRawAllowEIO3() types.Optional[bool]
func (*ServerOptions) GetRawAllowRequest ¶
func (s *ServerOptions) GetRawAllowRequest() types.Optional[AllowRequest]
func (*ServerOptions) GetRawAllowUpgrades ¶
func (s *ServerOptions) GetRawAllowUpgrades() types.Optional[bool]
func (*ServerOptions) GetRawCookie ¶
func (s *ServerOptions) GetRawCookie() types.Optional[*http.Cookie]
func (*ServerOptions) GetRawCors ¶
func (s *ServerOptions) GetRawCors() types.Optional[*types.Cors]
func (*ServerOptions) GetRawHttpCompression ¶
func (s *ServerOptions) GetRawHttpCompression() types.Optional[*types.HttpCompression]
func (*ServerOptions) GetRawInitialPacket ¶
func (s *ServerOptions) GetRawInitialPacket() types.Optional[io.Reader]
func (*ServerOptions) GetRawMaxHttpBufferSize ¶
func (s *ServerOptions) GetRawMaxHttpBufferSize() types.Optional[int64]
func (*ServerOptions) GetRawPerMessageDeflate ¶
func (s *ServerOptions) GetRawPerMessageDeflate() types.Optional[*types.PerMessageDeflate]
func (*ServerOptions) GetRawPingInterval ¶
func (s *ServerOptions) GetRawPingInterval() types.Optional[time.Duration]
func (*ServerOptions) GetRawPingTimeout ¶
func (s *ServerOptions) GetRawPingTimeout() types.Optional[time.Duration]
func (*ServerOptions) GetRawTransports ¶
func (s *ServerOptions) GetRawTransports() types.Optional[*types.Set[transports.TransportCtor]]
func (*ServerOptions) GetRawUpgradeTimeout ¶
func (s *ServerOptions) GetRawUpgradeTimeout() types.Optional[time.Duration]
func (*ServerOptions) HttpCompression ¶
func (s *ServerOptions) HttpCompression() *types.HttpCompression
func (*ServerOptions) InitialPacket ¶
func (s *ServerOptions) InitialPacket() io.Reader
func (*ServerOptions) MaxHttpBufferSize ¶
func (s *ServerOptions) MaxHttpBufferSize() int64
func (*ServerOptions) PerMessageDeflate ¶
func (s *ServerOptions) PerMessageDeflate() *types.PerMessageDeflate
func (*ServerOptions) PingInterval ¶
func (s *ServerOptions) PingInterval() time.Duration
func (*ServerOptions) PingTimeout ¶
func (s *ServerOptions) PingTimeout() time.Duration
func (*ServerOptions) SetAllowEIO3 ¶
func (s *ServerOptions) SetAllowEIO3(allowEIO3 bool)
whether to enable compatibility with Socket.IO v2 clients
func (*ServerOptions) SetAllowRequest ¶
func (s *ServerOptions) SetAllowRequest(allowRequest AllowRequest)
A function that receives a given handshake or upgrade request as its first parameter, and can decide whether to continue or not. The second argument is a function that needs to be called with the decided information: fn(err, success), where success is a boolean value where false means that the request is rejected, and err is an error code.
func (*ServerOptions) SetAllowUpgrades ¶
func (s *ServerOptions) SetAllowUpgrades(allowUpgrades bool)
whether to allow transport upgrades
Default: true
func (*ServerOptions) SetCookie ¶
func (s *ServerOptions) SetCookie(cookie *http.Cookie)
configuration of the cookie that contains the client sid to send as part of handshake response headers. This cookie might be used for sticky-session. Defaults to not sending any cookie.
func (*ServerOptions) SetCors ¶
func (s *ServerOptions) SetCors(cors *types.Cors)
the options that will be forwarded to the cors module
func (*ServerOptions) SetHttpCompression ¶
func (s *ServerOptions) SetHttpCompression(httpCompression *types.HttpCompression)
parameters of the http compression for the polling transports (see zlib api docs). Set to false to disable.
func (*ServerOptions) SetInitialPacket ¶
func (s *ServerOptions) SetInitialPacket(initialPacket io.Reader)
an optional packet which will be concatenated to the handshake packet emitted by Engine.IO.
func (*ServerOptions) SetMaxHttpBufferSize ¶
func (s *ServerOptions) SetMaxHttpBufferSize(maxHttpBufferSize int64)
how many bytes or characters a message can be, before closing the session (to avoid DoS).
func (*ServerOptions) SetPerMessageDeflate ¶
func (s *ServerOptions) SetPerMessageDeflate(perMessageDeflate *types.PerMessageDeflate)
parameters of the WebSocket permessage-deflate extension (see ws module api docs). Set to false to disable.
func (*ServerOptions) SetPingInterval ¶
func (s *ServerOptions) SetPingInterval(pingInterval time.Duration)
how many ms before sending a new ping packet
func (*ServerOptions) SetPingTimeout ¶
func (s *ServerOptions) SetPingTimeout(pingTimeout time.Duration)
how many ms without a pong packet to consider the connection closed
func (*ServerOptions) SetTransports ¶
func (s *ServerOptions) SetTransports(transports *types.Set[transports.TransportCtor])
The low-level transports that are enabled. WebTransport is disabled by default and must be manually enabled:
opts := &ServerOptions{}
opts.SetTransports(types.NewSet(engine.Polling, engine.Websocket, engine.WebTransport))
NewServer(opts)
func (*ServerOptions) SetUpgradeTimeout ¶
func (s *ServerOptions) SetUpgradeTimeout(upgradeTimeout time.Duration)
how many ms before an uncompleted transport upgrade is canceled
func (*ServerOptions) Transports ¶
func (s *ServerOptions) Transports() *types.Set[transports.TransportCtor]
func (*ServerOptions) UpgradeTimeout ¶
func (s *ServerOptions) UpgradeTimeout() time.Duration
type ServerOptionsInterface ¶
type ServerOptionsInterface interface {
SetPingTimeout(time.Duration)
GetRawPingTimeout() types.Optional[time.Duration]
PingTimeout() time.Duration
SetPingInterval(time.Duration)
GetRawPingInterval() types.Optional[time.Duration]
PingInterval() time.Duration
SetUpgradeTimeout(time.Duration)
GetRawUpgradeTimeout() types.Optional[time.Duration]
UpgradeTimeout() time.Duration
SetMaxHttpBufferSize(int64)
GetRawMaxHttpBufferSize() types.Optional[int64]
MaxHttpBufferSize() int64
SetAllowRequest(AllowRequest)
GetRawAllowRequest() types.Optional[AllowRequest]
AllowRequest() AllowRequest
SetTransports(*types.Set[transports.TransportCtor])
GetRawTransports() types.Optional[*types.Set[transports.TransportCtor]]
Transports() *types.Set[transports.TransportCtor]
SetAllowUpgrades(bool)
GetRawAllowUpgrades() types.Optional[bool]
AllowUpgrades() bool
SetPerMessageDeflate(*types.PerMessageDeflate)
GetRawPerMessageDeflate() types.Optional[*types.PerMessageDeflate]
PerMessageDeflate() *types.PerMessageDeflate
SetHttpCompression(*types.HttpCompression)
GetRawHttpCompression() types.Optional[*types.HttpCompression]
HttpCompression() *types.HttpCompression
SetInitialPacket(io.Reader)
GetRawInitialPacket() types.Optional[io.Reader]
InitialPacket() io.Reader
SetCookie(*http.Cookie)
GetRawCookie() types.Optional[*http.Cookie]
Cookie() *http.Cookie
SetCors(*types.Cors)
GetRawCors() types.Optional[*types.Cors]
Cors() *types.Cors
SetAllowEIO3(bool)
GetRawAllowEIO3() types.Optional[bool]
AllowEIO3() bool
}