Versions in this module Expand all Collapse all v3 v3.0.6 Jun 20, 2026 v3.0.5 Jun 13, 2026 Changes in this version + const DefaultConnectTimeout + const DefaultMaxDisconnectionDuration + const DefaultSessionCleanupInterval + const VERSION + var NAMESPACE_RESERVED_EVENTS = types.NewSet("connect", "connection", "new_namespace") + var RECOVERABLE_DISCONNECT_REASONS = types.NewSet("transport error", "transport close", "forced close", "ping timeout", ...) + var SOCKET_RESERVED_EVENTS = types.NewSet("connect", "connect_error", "disconnect", "disconnecting", "newListener", ...) + type Ack = func([]any, error) + type Adapter interface + AddAll func(SocketId, *types.Set[Room]) + AddSockets func(*BroadcastOptions, []Room) + Broadcast func(*parser.Packet, *BroadcastOptions) + BroadcastWithAck func(*parser.Packet, *BroadcastOptions, func(uint64), Ack) + Close func() + Construct func(Namespace) + Del func(SocketId, Room) + DelAll func(SocketId) + DelSockets func(*BroadcastOptions, []Room) + DisconnectSockets func(*BroadcastOptions, bool) + FetchSockets func(*BroadcastOptions) func(func([]SocketDetails, error)) + Init func() + Nsp func() Namespace + PersistSession func(*SessionToPersist) + Proto func() Adapter + Prototype func(Adapter) + RestoreSession func(PrivateSessionId, string) (*Session, error) + Rooms func() *types.Map[Room, *types.Set[SocketId]] + ServerCount func() int64 + ServerSideEmit func([]any) error + Sids func() *types.Map[SocketId, *types.Set[Room]] + SocketRooms func(SocketId) *types.Set[Room] + Sockets func(*types.Set[Room]) *types.Set[SocketId] + func MakeAdapter() Adapter + func NewAdapter(nsp Namespace) Adapter + type AdapterBuilder struct + func (*AdapterBuilder) New(nsp Namespace) Adapter + type AdapterConstructor interface + New func(Namespace) Adapter + type BroadcastFlags struct + Binary bool + Broadcast bool + ExpectSingleResponse bool + Local bool + Timeout *time.Duration + type BroadcastOperator struct + func MakeBroadcastOperator() *BroadcastOperator + func NewBroadcastOperator(adapter Adapter, rooms *types.Set[Room], exceptRooms *types.Set[Room], ...) *BroadcastOperator + func (b *BroadcastOperator) Compress(compress bool) *BroadcastOperator + func (b *BroadcastOperator) Construct(adapter Adapter, rooms *types.Set[Room], exceptRooms *types.Set[Room], ...) + func (b *BroadcastOperator) DisconnectSockets(status bool) + func (b *BroadcastOperator) Emit(ev string, args ...any) error + func (b *BroadcastOperator) EmitWithAck(ev string, args ...any) func(Ack) + func (b *BroadcastOperator) Except(room ...Room) *BroadcastOperator + func (b *BroadcastOperator) FetchSockets() func(func([]*RemoteSocket, error)) + func (b *BroadcastOperator) In(room ...Room) *BroadcastOperator + func (b *BroadcastOperator) Local() *BroadcastOperator + func (b *BroadcastOperator) SocketsJoin(room ...Room) + func (b *BroadcastOperator) SocketsLeave(room ...Room) + func (b *BroadcastOperator) Timeout(timeout time.Duration) *BroadcastOperator + func (b *BroadcastOperator) To(room ...Room) *BroadcastOperator + func (b *BroadcastOperator) Volatile() *BroadcastOperator + type BroadcastOptions struct + Except *types.Set[Room] + Flags *BroadcastFlags + Rooms *types.Set[Room] + type Client struct + func MakeClient() *Client + func NewClient(server *Server, conn engine.Socket) *Client + func (c *Client) Conn() engine.Socket + func (c *Client) Construct(server *Server, conn engine.Socket) + func (c *Client) Request() *types.HttpContext + func (c *Client) WriteToEngine(encodedPackets []types.BufferInterface, opts *WriteOptions) + type ConnectionStateRecovery struct + func DefaultConnectionStateRecovery() *ConnectionStateRecovery + func (c *ConnectionStateRecovery) Assign(data ConnectionStateRecoveryInterface) ConnectionStateRecoveryInterface + func (c *ConnectionStateRecovery) GetRawMaxDisconnectionDuration() types.Optional[int64] + func (c *ConnectionStateRecovery) GetRawSessionCleanupInterval() types.Optional[time.Duration] + func (c *ConnectionStateRecovery) GetRawSkipMiddlewares() types.Optional[bool] + func (c *ConnectionStateRecovery) MaxDisconnectionDuration() int64 + func (c *ConnectionStateRecovery) SessionCleanupInterval() time.Duration + func (c *ConnectionStateRecovery) SetMaxDisconnectionDuration(maxDisconnectionDuration int64) + func (c *ConnectionStateRecovery) SetSessionCleanupInterval(sessionCleanupInterval time.Duration) + func (c *ConnectionStateRecovery) SetSkipMiddlewares(skipMiddlewares bool) + func (c *ConnectionStateRecovery) SkipMiddlewares() bool + type ConnectionStateRecoveryInterface interface + GetRawMaxDisconnectionDuration func() types.Optional[int64] + GetRawSessionCleanupInterval func() types.Optional[time.Duration] + GetRawSkipMiddlewares func() types.Optional[bool] + MaxDisconnectionDuration func() int64 + SessionCleanupInterval func() time.Duration + SetMaxDisconnectionDuration func(int64) + SetSessionCleanupInterval func(time.Duration) + SetSkipMiddlewares func(bool) + SkipMiddlewares func() bool + type ExtendedError = types.ExtendedError + func NewExtendedError(message string, data any) *ExtendedError + type Handshake struct + Address string + Auth map[string]any + Headers types.IncomingHttpHeaders + Issued int64 + Query types.ParsedUrlQuery + Secure bool + Time string + Url string + Xdomain bool + type Namespace interface + Adapter func() Adapter + Add func(*Client, map[string]any, func(*Socket)) + Cleanup func(types.Callable) + Compress func(bool) *BroadcastOperator + Construct func(*Server, string) + DisconnectSockets func(bool) + Emit func(string, ...any) error + EmitReserved func(string, ...any) + EmitUntyped func(string, ...any) + EventEmitter func() *StrictEventEmitter + Except func(...Room) *BroadcastOperator + FetchSockets func() func(func([]*RemoteSocket, error)) + Fns func() *types.Slice[NamespaceMiddleware] + Ids func() uint64 + In func(...Room) *BroadcastOperator + InitAdapter func() + Listeners func(string) []types.EventListener + Local func() *BroadcastOperator + Name func() string + On func(string, ...types.EventListener) error + OnServerSideEmit func([]any) + Once func(string, ...types.EventListener) error + Proto func() Namespace + Prototype func(Namespace) + Remove func(*Socket) + Send func(...any) Namespace + Server func() *Server + ServerSideEmit func(string, ...any) error + ServerSideEmitWithAck func(string, ...any) func(Ack) error + Sockets func() *types.Map[SocketId, *Socket] + SocketsJoin func(...Room) + SocketsLeave func(...Room) + Timeout func(time.Duration) *BroadcastOperator + To func(...Room) *BroadcastOperator + Use func(NamespaceMiddleware) Namespace + Volatile func() *BroadcastOperator + Write func(...any) Namespace + func MakeNamespace() Namespace + func NewNamespace(server *Server, name string) Namespace + type NamespaceMiddleware = func(*Socket, func(*ExtendedError)) + type ParentBroadcastAdapter interface + func MakeParentBroadcastAdapter() ParentBroadcastAdapter + func NewParentBroadcastAdapter(nsp Namespace) ParentBroadcastAdapter + type ParentBroadcastAdapterBuilder struct + func (b *ParentBroadcastAdapterBuilder) New(nsp Namespace) Adapter + type ParentNamespace interface + Children func() *types.Set[Namespace] + CreateChild func(string) Namespace + func MakeParentNamespace() ParentNamespace + func NewParentNamespace(server *Server) ParentNamespace + type ParentNspNameMatchFn *func(string, map[string]any, func(error, bool)) + type PersistedPacket struct + Data any + EmittedAt int64 + Id string + Opts *BroadcastOptions + type PollingBuilder = transports.PollingBuilder + type PrivateSessionId string + type RemoteSocket struct + func MakeRemoteSocket() *RemoteSocket + func NewRemoteSocket(adapter Adapter, details SocketDetails) *RemoteSocket + func (r *RemoteSocket) Construct(adapter Adapter, details SocketDetails) + func (r *RemoteSocket) Data() any + func (r *RemoteSocket) Disconnect(status bool) *RemoteSocket + func (r *RemoteSocket) Emit(ev string, args ...any) error + func (r *RemoteSocket) Handshake() *Handshake + func (r *RemoteSocket) Id() SocketId + func (r *RemoteSocket) Join(room ...Room) + func (r *RemoteSocket) Leave(room ...Room) + func (r *RemoteSocket) Rooms() *types.Set[Room] + func (r *RemoteSocket) Timeout(timeout time.Duration) *BroadcastOperator + type Room string + type Server struct + func MakeServer() *Server + func NewServer(srv any, opts ServerOptionsInterface) *Server + func (s *Server) Adapter() AdapterConstructor + func (s *Server) Attach(srv any, opts *ServerOptions) *Server + func (s *Server) Bind(egs engine.BaseServer) *Server + func (s *Server) Close(fn func(error)) + func (s *Server) Compress(compress bool) *BroadcastOperator + func (s *Server) ConnectTimeout() time.Duration + func (s *Server) Construct(srv any, opts ServerOptionsInterface) + func (s *Server) DisconnectSockets(status bool) + func (s *Server) Emit(ev string, args ...any) *Server + func (s *Server) Encoder() parser.Encoder + func (s *Server) Engine() engine.BaseServer + func (s *Server) Except(room ...Room) *BroadcastOperator + func (s *Server) FetchSockets() func(func([]*RemoteSocket, error)) + func (s *Server) In(room ...Room) *BroadcastOperator + func (s *Server) Listen(srv any, opts *ServerOptions) *Server + func (s *Server) Local() *BroadcastOperator + func (s *Server) Of(name any, fn types.EventListener) Namespace + func (s *Server) Opts() ServerOptionsInterface + func (s *Server) Path() string + func (s *Server) Send(args ...any) *Server + func (s *Server) ServeClient() bool + func (s *Server) ServeHandler(opts *ServerOptions) http.Handler + func (s *Server) ServerSideEmit(ev string, args ...any) error + func (s *Server) ServerSideEmitWithAck(ev string, args ...any) func(Ack) error + func (s *Server) SetAdapter(v AdapterConstructor) *Server + func (s *Server) SetConnectTimeout(v time.Duration) *Server + func (s *Server) SetPath(v string) *Server + func (s *Server) SetServeClient(v bool) *Server + func (s *Server) Sockets() Namespace + func (s *Server) SocketsJoin(room ...Room) + func (s *Server) SocketsLeave(room ...Room) + func (s *Server) Timeout(timeout time.Duration) *BroadcastOperator + func (s *Server) To(room ...Room) *BroadcastOperator + func (s *Server) Use(fn NamespaceMiddleware) *Server + func (s *Server) Volatile() *BroadcastOperator + func (s *Server) Write(args ...any) *Server + type ServerOptions struct + func DefaultServerOptions() *ServerOptions + func (s *ServerOptions) Adapter() AdapterConstructor + func (s *ServerOptions) Assign(data ServerOptionsInterface) ServerOptionsInterface + func (s *ServerOptions) CleanupEmptyChildNamespaces() bool + func (s *ServerOptions) ClientVersion() string + func (s *ServerOptions) ConnectTimeout() time.Duration + func (s *ServerOptions) ConnectionStateRecovery() ConnectionStateRecoveryInterface + func (s *ServerOptions) GetRawAdapter() types.Optional[AdapterConstructor] + func (s *ServerOptions) GetRawCleanupEmptyChildNamespaces() types.Optional[bool] + func (s *ServerOptions) GetRawClientVersion() types.Optional[string] + func (s *ServerOptions) GetRawConnectTimeout() types.Optional[time.Duration] + func (s *ServerOptions) GetRawConnectionStateRecovery() types.Optional[ConnectionStateRecoveryInterface] + func (s *ServerOptions) GetRawParser() types.Optional[parser.Parser] + func (s *ServerOptions) GetRawServeClient() types.Optional[bool] + func (s *ServerOptions) Parser() parser.Parser + func (s *ServerOptions) ServeClient() bool + func (s *ServerOptions) SetAdapter(adapter AdapterConstructor) + func (s *ServerOptions) SetCleanupEmptyChildNamespaces(cleanupEmptyChildNamespaces bool) + func (s *ServerOptions) SetClientVersion(clientVersion string) + func (s *ServerOptions) SetConnectTimeout(connectTimeout time.Duration) + func (s *ServerOptions) SetConnectionStateRecovery(connectionStateRecovery ConnectionStateRecoveryInterface) + func (s *ServerOptions) SetParser(parser parser.Parser) + func (s *ServerOptions) SetServeClient(serveClient bool) + type ServerOptionsInterface interface + Adapter func() AdapterConstructor + CleanupEmptyChildNamespaces func() bool + ClientVersion func() string + ConnectTimeout func() time.Duration + ConnectionStateRecovery func() ConnectionStateRecoveryInterface + GetRawAdapter func() types.Optional[AdapterConstructor] + GetRawCleanupEmptyChildNamespaces func() types.Optional[bool] + GetRawClientVersion func() types.Optional[string] + GetRawConnectTimeout func() types.Optional[time.Duration] + GetRawConnectionStateRecovery func() types.Optional[ConnectionStateRecoveryInterface] + GetRawParser func() types.Optional[parser.Parser] + GetRawServeClient func() types.Optional[bool] + Parser func() parser.Parser + ServeClient func() bool + SetAdapter func(AdapterConstructor) + SetCleanupEmptyChildNamespaces func(bool) + SetClientVersion func(string) + SetConnectTimeout func(time.Duration) + SetConnectionStateRecovery func(ConnectionStateRecoveryInterface) + SetParser func(parser.Parser) + SetServeClient func(bool) + type Session struct + MissedPackets []any + type SessionAwareAdapter interface + func MakeSessionAwareAdapter() SessionAwareAdapter + func NewSessionAwareAdapter(nsp Namespace) SessionAwareAdapter + type SessionAwareAdapterBuilder struct + func (*SessionAwareAdapterBuilder) New(nsp Namespace) Adapter + type SessionData struct + Offset any + Pid any + func (s *SessionData) GetOffset() (offset string, ok bool) + func (s *SessionData) GetPid() (pid string, ok bool) + type SessionToPersist struct + Data any + Pid PrivateSessionId + Rooms *types.Set[Room] + Sid SocketId + type SessionWithTimestamp struct + DisconnectedAt int64 + type Socket struct + func MakeSocket() *Socket + func NewSocket(nsp Namespace, client *Client, auth map[string]any, previousSession *Session) *Socket + func (s *Socket) Acks() *types.Map[uint64, Ack] + func (s *Socket) Broadcast() *BroadcastOperator + func (s *Socket) Client() *Client + func (s *Socket) Compress(compress bool) *Socket + func (s *Socket) Conn() engine.Socket + func (s *Socket) Connected() bool + func (s *Socket) Construct(nsp Namespace, client *Client, auth map[string]any, previousSession *Session) + func (s *Socket) Data() any + func (s *Socket) Disconnect(status bool) *Socket + func (s *Socket) Disconnected() bool + func (s *Socket) Emit(ev string, args ...any) error + func (s *Socket) EmitWithAck(ev string, args ...any) func(Ack) + func (s *Socket) Enqueue(task func()) + func (s *Socket) Except(room ...Room) *BroadcastOperator + func (s *Socket) Handshake() *Handshake + func (s *Socket) Id() SocketId + func (s *Socket) In(room ...Room) *BroadcastOperator + func (s *Socket) Join(rooms ...Room) + func (s *Socket) Leave(room Room) + func (s *Socket) ListenersAny() []types.EventListener + func (s *Socket) ListenersAnyOutgoing() []types.EventListener + func (s *Socket) Local() *BroadcastOperator + func (s *Socket) NotifyOutgoingListeners() func(*parser.Packet) + func (s *Socket) Nsp() Namespace + func (s *Socket) OffAny(listener types.EventListener) *Socket + func (s *Socket) OffAnyOutgoing(listener types.EventListener) *Socket + func (s *Socket) OnAny(listener types.EventListener) *Socket + func (s *Socket) OnAnyOutgoing(listener types.EventListener) *Socket + func (s *Socket) PrependAny(listener types.EventListener) *Socket + func (s *Socket) PrependAnyOutgoing(listener types.EventListener) *Socket + func (s *Socket) Recovered() bool + func (s *Socket) Request() *types.HttpContext + func (s *Socket) Rooms() *types.Set[Room] + func (s *Socket) Send(args ...any) *Socket + func (s *Socket) SetData(data any) + func (s *Socket) Timeout(timeout time.Duration) *Socket + func (s *Socket) To(room ...Room) *BroadcastOperator + func (s *Socket) Use(fn SocketMiddleware) *Socket + func (s *Socket) Volatile() *Socket + func (s *Socket) Write(args ...any) *Socket + type SocketDetails interface + Data func() any + Handshake func() *Handshake + Id func() SocketId + Rooms func() *types.Set[Room] + type SocketId string + type SocketMiddleware = func([]any, func(error)) + type StrictEventEmitter struct + func NewStrictEventEmitter() *StrictEventEmitter + func (s *StrictEventEmitter) Emit(ev string, args ...any) + func (s *StrictEventEmitter) EmitReserved(ev string, args ...any) + func (s *StrictEventEmitter) EmitUntyped(ev string, args ...any) + func (s *StrictEventEmitter) Listeners(ev string) []types.EventListener + func (s *StrictEventEmitter) On(ev string, listeners ...types.EventListener) error + func (s *StrictEventEmitter) Once(ev string, listeners ...types.EventListener) error + type TransportCtor = transports.TransportCtor + var Polling TransportCtor = &PollingBuilder{} + var WebSocket TransportCtor = &WebSocketBuilder{} + var WebTransport TransportCtor = &WebTransportBuilder{} + type WebSocketBuilder = transports.WebSocketBuilder + type WebTransportBuilder = transports.WebTransportBuilder + type WriteOptions struct + PreEncoded bool + Volatile bool