Documentation ¶
Index ¶
- func GenerateClientID() string
- type CloseType
- type Event
- type Option
- type Service
- func (s *Service) Broadcast(e Event)
- func (s *Service) CloseAllClients()
- func (s *Service) CloseClient(clientID interface{}) error
- func (s *Service) GetClientCount() int
- func (s *Service) HandleClient(clientID interface{}, w http.ResponseWriter) (<-chan CloseType, error)
- func (s *Service) Send(clientID interface{}, e Event) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateClientID ¶
func GenerateClientID() string
GenerateClientID is used to generate an uuid randomly
Types ¶
type CloseType ¶
type CloseType int
CloseType present the type of closing
const ( // ClientClose present client initiative to disconnect ClientClose CloseType // ServerClose present server initiative to disconnect ServerClose )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the type of sse service instance
func NewServiceWithOption ¶
NewServiceWithOption is used to create a sse.Service instance with additional option
func (*Service) CloseAllClients ¶
func (s *Service) CloseAllClients()
CloseAllClients is used to disconnect all clients
func (*Service) CloseClient ¶
CloseClient is used to disconnect client by server
func (*Service) GetClientCount ¶
GetClientCount is used to get count of client
func (*Service) HandleClient ¶
func (s *Service) HandleClient(clientID interface{}, w http.ResponseWriter) (<-chan CloseType, error)
HandleClient is used to handle a client with streaming and returns a chan of closing
Click to show internal directories.
Click to hide internal directories.