Documentation ¶
Index ¶
- func EchoHandler(_ context.Context, s *Service, conn *Connection, svc string, cmd string, ...) error
- func LogHandler(_ context.Context, _ *Service, conn *Connection, svc string, cmd string, ...) error
- func OnMessage(ctx context.Context, s *Service, connID uuid.UUID, message *Message, ...) error
- func ReadSocketLoop(connID uuid.UUID, sock *websocket.Conn, onMessage func(m *Message) error, ...) error
- type Channel
- type ConnectEvent
- type Connection
- type Handler
- type Message
- type OnlineUpdate
- type Service
- func (s *Service) Broadcast(message *Message, logger util.Logger, except ...uuid.UUID) error
- func (s *Service) ChannelList(params *filter.Params) []string
- func (s *Service) Close()
- func (s *Service) Count() int
- func (s *Service) Disconnect(connID uuid.UUID, logger util.Logger) (bool, error)
- func (s *Service) GetAllMembers(key string) []*Connection
- func (s *Service) GetByID(id uuid.UUID, logger util.Logger) *Status
- func (s *Service) GetChannel(ch string) *Channel
- func (s *Service) GetConnection(id uuid.UUID) *Connection
- func (s *Service) GetOnline(key string) []uuid.UUID
- func (s *Service) Join(connID uuid.UUID, ch string, logger util.Logger) (bool, error)
- func (s *Service) Leave(connID uuid.UUID, ch string, logger util.Logger) (bool, error)
- func (s *Service) ReadLoop(ctx context.Context, connID uuid.UUID, logger util.Logger) error
- func (s *Service) Register(profile *user.Profile, c *websocket.Conn, h Handler, logger util.Logger) (*Connection, error)
- func (s *Service) RegisterTap(w http.ResponseWriter, r *http.Request, logger util.Logger) (uuid.UUID, error)
- func (s *Service) RemoveTap(connID uuid.UUID, logger util.Logger)
- func (s *Service) ReplaceHandlers(onOpen ConnectEvent, onClose ConnectEvent)
- func (s *Service) Status() ([]string, []*Connection, []uuid.UUID)
- func (s *Service) Terminal(ch string, logger util.Logger) func(_ string, b []byte) error
- func (s *Service) Upgrade(ctx context.Context, w http.ResponseWriter, r *http.Request, channel string, ...) (uuid.UUID, error)
- func (s *Service) UserList(params *filter.Params) Statuses
- func (s *Service) WriteChannel(message *Message, logger util.Logger, except ...uuid.UUID) error
- func (s *Service) WriteCloseRequest(connID uuid.UUID, logger util.Logger) error
- func (s *Service) WriteMessage(connID uuid.UUID, message *Message, logger util.Logger) error
- func (s *Service) WriteTap(message *Message, logger util.Logger)
- type Status
- type Statuses
- type UpdateMemberParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EchoHandler ¶ added in v1.3.1
func LogHandler ¶ added in v1.3.1
Types ¶
type ConnectEvent ¶
type ConnectEvent func(s *Service, conn *Connection, logger util.Logger) error
type Connection ¶
type Connection struct { ID uuid.UUID `json:"id"` Profile *user.Profile `json:"profile,omitempty"` Svc string `json:"svc,omitempty"` ModelID *uuid.UUID `json:"modelID,omitempty"` Channels []string `json:"channels,omitempty"` Started time.Time `json:"started,omitempty"` // contains filtered or unexported fields }
func NewConnection ¶
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) Read ¶
func (c *Connection) Read() ([]byte, error)
func (*Connection) String ¶ added in v0.7.0
func (c *Connection) String() string
func (*Connection) ToStatus ¶
func (c *Connection) ToStatus() *Status
func (*Connection) Username ¶ added in v0.8.17
func (c *Connection) Username() string
func (*Connection) Write ¶
func (c *Connection) Write(b []byte) error
type Message ¶
type OnlineUpdate ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(onOpen ConnectEvent, onClose ConnectEvent) *Service
func (*Service) Disconnect ¶
func (*Service) GetAllMembers ¶ added in v0.6.22
func (s *Service) GetAllMembers(key string) []*Connection
func (*Service) GetChannel ¶ added in v0.6.22
func (*Service) GetConnection ¶ added in v0.6.22
func (s *Service) GetConnection(id uuid.UUID) *Connection
func (*Service) RegisterTap ¶ added in v0.7.0
func (*Service) ReplaceHandlers ¶ added in v1.2.10
func (s *Service) ReplaceHandlers(onOpen ConnectEvent, onClose ConnectEvent)
func (*Service) WriteChannel ¶
func (*Service) WriteCloseRequest ¶ added in v1.5.18
func (*Service) WriteMessage ¶
type UpdateMemberParams ¶
Click to show internal directories.
Click to hide internal directories.