Documentation
¶
Index ¶
- Constants
- type BroadcastClient
- type Client
- type Hub
- func (h *Hub) AddClient(client *Client)
- func (h *Hub) Broadcast(message []byte)
- func (h *Hub) Clients() (clients []*Client)
- func (h *Hub) Recv(client *Client, b []byte)
- func (h *Hub) Run()
- func (h *Hub) Send(client *Client, message []byte)
- func (h *Hub) Subscribe(command string, f func(client IStreamClient, msg Message))
- func (h *Hub) Subscriber(command string) (f func(client IStreamClient, msg Message))
- func (h *Hub) UnSubscribe(command string)
- type IStreamClient
- type Message
- type StreamService
Constants ¶
View Source
const ( // Request ... Request = "request" // Response ... Response = "response" // StatusSuccess ... StatusSuccess = "success" // StatusError ... StatusError = "error" // Notify ... Notify = "notify" // Broadcast ... Broadcast = "broadcast" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastClient ¶ added in v0.0.15
type BroadcastClient interface {
Broadcast(message []byte)
}
BroadcastClient ...
type Client ¶
type Client struct {
Ip string
Referer string
UserAgent string
Width int
Height int
Cookie bool
Language string
Platform string
Location string
Href string
Send chan []byte // message buffered channel
Connect *websocket.Conn
// contains filtered or unexported fields
}
Client ...
type Hub ¶
Hub ...
func (*Hub) Subscribe ¶
func (h *Hub) Subscribe(command string, f func(client IStreamClient, msg Message))
Subscribe ...
func (*Hub) Subscriber ¶ added in v0.0.15
func (h *Hub) Subscriber(command string) (f func(client IStreamClient, msg Message))
Subscriber ...
type IStreamClient ¶ added in v0.1.1
IStreamClient ...
type Message ¶ added in v0.0.9
type Message struct {
Id uuid.UUID `json:"id"`
Command string `json:"command"`
Payload map[string]interface{} `json:"payload"`
Forward string `json:"forward"`
Status string `json:"status"`
Type string `json:"type"`
}
Message ...
func NewMessage ¶ added in v0.0.9
NewMessage ...
type StreamService ¶
type StreamService struct {
Hub *Hub
}
StreamService ...
func (*StreamService) Subscribe ¶
func (s *StreamService) Subscribe(command string, f func(client IStreamClient, msg Message))
Subscribe ...
func (*StreamService) UnSubscribe ¶
func (s *StreamService) UnSubscribe(command string)
UnSubscribe ...
Click to show internal directories.
Click to hide internal directories.