Documentation
¶
Index ¶
- type DefaultProtocol
- type IncomingMessage
- type Message
- type MessageHandler
- type MessageProtocol
- type Room
- func (r *Room) Assign(s *Session)
- func (r *Room) Broadcast(path string, data []byte) error
- func (r *Room) BroadcastExcept(path string, data []byte, exceptions []string) error
- func (r *Room) Destroy()
- func (r *Room) GetMember(sessionId string) (*Session, bool)
- func (r *Room) HasMember(sessionId string) bool
- func (r *Room) ID() string
- func (r *Room) MemberCount() int
- func (r *Room) MemberIDs() []string
- func (r *Room) Members() []*Session
- func (r *Room) MembersIter() iter.Seq2[string, *Session]
- func (r *Room) OnCreate(f func(ctx context.Context))
- func (r *Room) OnDestroy(f func())
- func (r *Room) OnJoin(f func(s *Session))
- func (r *Room) OnLeave(f func(s *Session))
- func (r *Room) SetRouter(router *Router)
- func (r *Room) Unassign(s *Session)
- type RoomFactory
- type Router
- type Server
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultProtocol ¶
type DefaultProtocol struct{}
Simple, but working binary codec
func NewDefaultProtocol ¶
func NewDefaultProtocol() DefaultProtocol
func (DefaultProtocol) ReadMessage ¶
func (DefaultProtocol) ReadMessage(dest *Message, r io.Reader) error
func (DefaultProtocol) WriteMessage ¶
func (DefaultProtocol) WriteMessage(w io.Writer, src Message) error
type IncomingMessage ¶
type MessageHandler ¶
type MessageHandler func(ctx context.Context, msg IncomingMessage)
type MessageProtocol ¶
type Room ¶
type Room struct {
// contains filtered or unexported fields
}
func (*Room) BroadcastExcept ¶
func (*Room) MemberCount ¶
type RoomFactory ¶
type RoomFactory func(r *Room)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouterWithSep ¶
func (*Router) Handle ¶
func (r *Router) Handle(route string, handler MessageHandler)
func (*Router) HandleFallback ¶
func (r *Router) HandleFallback(handler MessageHandler)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CreateRoom ¶
func (*Server) RegisterRoomFactory ¶
func (s *Server) RegisterRoomFactory(typ string, f RoomFactory)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.