Documentation
¶
Overview ¶
Package socketio provides a Socket.IO server that implements the transport.Server interface.
It wraps the go-socket.io library with gorilla/mux routing and CORS support. The server lifecycle is managed via the standard Start/Stop pattern, making it compatible with [wind.App].
Index ¶
- Constants
- type Option
- func WithAddress(addr string) Option
- func WithCodec(c string) Option
- func WithConnectHandler(namespace string, f func(socketIo.Conn) error) Option
- func WithDisconnectHandler(namespace string, f func(socketIo.Conn, string)) Option
- func WithErrorHandler(namespace string, f func(socketIo.Conn, error)) Option
- func WithEventHandler(namespace, event string, f any) Option
- func WithNetwork(network string) Option
- func WithPath(path string) Option
- func WithTLSConfig(c *tls.Config) Option
- type Server
- func (s *Server) Endpoint() string
- func (s *Server) RegisterConnectHandler(namespace string, f func(socketIo.Conn) error)
- func (s *Server) RegisterDisconnectHandler(namespace string, f func(socketIo.Conn, string))
- func (s *Server) RegisterErrorHandler(namespace string, f func(socketIo.Conn, error))
- func (s *Server) RegisterEventHandler(namespace, event string, f any)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(_ context.Context) error
Constants ¶
View Source
const KindSocketIo = "socket.io"
KindSocketIo 是 Socket.IO 传输类型标识。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(o *Server)
func WithAddress ¶
func WithConnectHandler ¶
func WithDisconnectHandler ¶
func WithErrorHandler ¶
func WithEventHandler ¶
func WithNetwork ¶
func WithTLSConfig ¶
type Server ¶
func (*Server) RegisterConnectHandler ¶
func (*Server) RegisterDisconnectHandler ¶
func (*Server) RegisterErrorHandler ¶
func (*Server) RegisterEventHandler ¶
Click to show internal directories.
Click to hide internal directories.