Versions in this module Expand all Collapse all v0 v0.5.1 Aug 11, 2026 v0.5.0 Aug 11, 2026 Changes in this version + const DefaultMaxSessions + const MaxAttachments + var ErrAckTimeout = errors.New("socketio: ack timeout") + var ErrTooManyAttachments = fmt.Errorf("%w: too many binary attachments (max %d)", ErrInvalidPacket, MaxAttachments) + func AllowedOrigins(origins ...string) func(*http.Request) bool type Handshake + func NewProxiedHandshake(r *http.Request, auth any) *Handshake type Options + MaxSessions int + TrustProxy bool type Socket + func (s *Socket) Handshake() *Handshake + func (s *Socket) OnDisconnecting(fn func(reason string)) *Socket + func (s *Socket) PendingAcks() int v0.4.0 Jul 19, 2026 v0.3.0 Jul 18, 2026 Changes in this version + var ErrEmptyEvent = errors.New("socketio: empty event name") + var ErrReservedEvent = errors.New("socketio: reserved event name") + func IsReservedEvent(name string) bool + func ReservedEvents() []string + func ValidateEventName(name string) error type BroadcastOperator + func (b *BroadcastOperator) ExceptRoom(rooms ...string) *BroadcastOperator + func (b *BroadcastOperator) Local() *BroadcastOperator + func (b *BroadcastOperator) Timeout(d time.Duration) *BroadcastOperator + type Decoder struct + func NewDecoder() *Decoder + func (d *Decoder) Add(frame any) (*Packet, error) + func (d *Decoder) Pending() bool + func (d *Decoder) Reset() + type Encoder struct + func NewEncoder() *Encoder + func (e *Encoder) Encode(p Packet) ([]any, error) + type Handshake struct + Address string + Auth any + Headers http.Header + Issued int64 + Query url.Values + Secure bool + Time time.Time + URL string + XDomain bool + func NewHandshake(r *http.Request, auth any) *Handshake + func (h *Handshake) Get(header string) string + func (h *Handshake) Param(key string) string type Namespace + func (ns *Namespace) Except(room string) *BroadcastOperator + func (ns *Namespace) In(room string) *BroadcastOperator + func (ns *Namespace) Local() *BroadcastOperator type Packet + func (p Packet) HasBinaryData() bool type Server + func (s *Server) Except(room string) *BroadcastOperator + func (s *Server) In(room string) *BroadcastOperator + func (s *Server) Local() *BroadcastOperator type Socket + func (s *Socket) Except(room string) *BroadcastOperator + func (s *Socket) In(room string) *BroadcastOperator + func (s *Socket) ListenersAny() []func(event string, args []any) + func (s *Socket) OffAny() *Socket + func (s *Socket) OnAny(fn func(event string, args []any)) *Socket + func (s *Socket) PrependAny(fn func(event string, args []any)) *Socket v0.2.0 Jul 5, 2026 v0.1.0 Jul 4, 2026 Changes in this version + const DefaultPath + const ProtocolVersion + var ErrInvalidPacket = errors.New("socketio: invalid packet") + func Reconstruct(data any, buffers [][]byte) any + type Adapter interface + Add func(socketID string, s *Socket) + AllSockets func() []*Socket + Get func(socketID string) (*Socket, bool) + Join func(socketID, room string) + Leave func(socketID, room string) + Remove func(socketID string) + SocketsInRoom func(room string) []*Socket + type BroadcastOperator struct + func (b *BroadcastOperator) Compress(on bool) *BroadcastOperator + func (b *BroadcastOperator) Emit(event string, args ...any) + func (b *BroadcastOperator) Except(socketID string) *BroadcastOperator + func (b *BroadcastOperator) In(room string) *BroadcastOperator + func (b *BroadcastOperator) To(room string) *BroadcastOperator + func (b *BroadcastOperator) Volatile() *BroadcastOperator + type BroadcastTarget interface + type Broadcaster interface + Close func() error + OnMessage func(func(data []byte)) + Publish func(data []byte) error + type Emitter interface + Emit func(event string, args ...any) + type EventHandler func(args []any) []any + type Namespace struct + func (ns *Namespace) DisconnectSockets(closeTransport bool) + func (ns *Namespace) Emit(event string, args ...any) + func (ns *Namespace) FetchSockets() []*Socket + func (ns *Namespace) Name() string + func (ns *Namespace) OnConnection(fn func(*Socket)) *Namespace + func (ns *Namespace) SetAdapter(a Adapter) *Namespace + func (ns *Namespace) Sockets() []*Socket + func (ns *Namespace) SocketsInRoom(room string) []*Socket + func (ns *Namespace) SocketsJoin(rooms ...string) + func (ns *Namespace) SocketsLeave(rooms ...string) + func (ns *Namespace) To(room string) *BroadcastOperator + func (ns *Namespace) Use(fn func(socket *Socket, next func(err error))) *Namespace + type Options struct + CheckOrigin func(r *http.Request) bool + MaxPayload int + Path string + PingInterval time.Duration + PingTimeout time.Duration + type Packet struct + Data any + ID *uint64 + Namespace string + Type PacketType + func DecodePacket(s string) (Packet, error) + func (p Packet) Args() []any + func (p Packet) Attachments() int + func (p Packet) Encode() (string, error) + func (p Packet) EncodeBinary() (text string, buffers [][]byte, err error) + func (p Packet) EventName() string + type PacketType byte + const Ack + const BinaryAck + const BinaryEvent + const Connect + const ConnectError + const Disconnect + const Event + func (t PacketType) String() string + type RoomTargeter interface + To func(room string) *BroadcastOperator + type Server struct + func New(opts ...Options) *Server + func (s *Server) Attach(mux *http.ServeMux) + func (s *Server) Close() + func (s *Server) DisconnectSockets(closeTransport bool) + func (s *Server) Emit(event string, args ...any) + func (s *Server) FetchSockets() []*Socket + func (s *Server) Handler(next http.Handler) http.Handler + func (s *Server) Of(name string) *Namespace + func (s *Server) OnConnection(fn func(*Socket)) + func (s *Server) OnServerEvent(event string, handler func(args []any)) *Server + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) ServerSideEmit(event string, args ...any) + func (s *Server) SetBroadcaster(b Broadcaster) *Server + func (s *Server) Sockets() []*Socket + func (s *Server) SocketsJoin(rooms ...string) + func (s *Server) SocketsLeave(rooms ...string) + func (s *Server) To(room string) *BroadcastOperator + func (s *Server) Use(fn func(socket *Socket, next func(err error))) *Server + type Socket struct + func (s *Socket) Auth() any + func (s *Socket) Broadcast() *BroadcastOperator + func (s *Socket) Data() map[string]any + func (s *Socket) Delete(key string) *Socket + func (s *Socket) Disconnect(closeTransport bool) + func (s *Socket) Emit(event string, args ...any) error + func (s *Socket) EmitAck(event string, timeout time.Duration, args ...any) ([]any, error) + func (s *Socket) EmitWithAck(event string, ackFn func(args []any), args ...any) error + func (s *Socket) Get(key string) (any, bool) + func (s *Socket) GetString(key string) string + func (s *Socket) ID() string + func (s *Socket) Join(rooms ...string) *Socket + func (s *Socket) Leave(rooms ...string) *Socket + func (s *Socket) Namespace() *Namespace + func (s *Socket) Off(event string) *Socket + func (s *Socket) On(event string, handler EventHandler) *Socket + func (s *Socket) OnDisconnect(fn func(reason string)) *Socket + func (s *Socket) Rooms() []string + func (s *Socket) Set(key string, value any) *Socket + func (s *Socket) To(room string) *BroadcastOperator