socketio

package
v0.0.0-...-b87ab60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSIOHandlers

func NewSIOHandlers() map[string]interface{}

func ToString

func ToString(c sio.Conn) string

Types

type Room

type Room struct {
}

type RoomManager

type RoomManager struct {
}

type Server

type Server struct {
	SocketIOToSessions map[string]*Session
	UIDSceneToSessions map[string]*Session
	UIDToSessions      map[string]*Session
	sync.Mutex
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) AcceptSession

func (s *Server) AcceptSession(session *Session, query string) (error int)

func (*Server) DisconnectSession

func (s *Server) DisconnectSession(conn sio.Conn) *Session

func (*Server) MountHandlers

func (s *Server) MountHandlers(nsp string, handlers map[string]interface{})

func (*Server) OnConnect

func (s *Server) OnConnect(f func(sio.Conn) error)

func (*Server) OnDisconnect

func (s *Server) OnDisconnect(f func(sio.Conn, string))

func (*Server) OnError

func (s *Server) OnError(f func(sio.Conn, error))

func (*Server) Run

func (s *Server) Run(cfg *cfgargs.SrvConfig) error

func (*Server) SetNameSpace

func (s *Server) SetNameSpace(nsp string)

SetNameSpace 改变默认的namespace

func (*Server) SocketIOToSession

func (s *Server) SocketIOToSession(c sio.Conn) *Session

func (*Server) UIDSceneToSession

func (s *Server) UIDSceneToSession(uidScene string) *Session

type Session

type Session struct {
	Conn sio.Conn
	// contains filtered or unexported fields
}

func NewSession

func NewSession(conn sio.Conn) *Session

func (*Session) Auth

func (s *Session) Auth(token string) (*model.User, error)

func (*Session) ID

func (s *Session) ID() string

func (*Session) SetScene

func (s *Session) SetScene(scene string)

func (*Session) ToString

func (s *Session) ToString() string

func (*Session) UIDSceneString

func (s *Session) UIDSceneString() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL