Skip to content

Commit

Permalink
Added NumClients to stream object
Browse files Browse the repository at this point in the history
  • Loading branch information
chripo authored and AndrewBurian committed Nov 23, 2018
1 parent 5e78397 commit 8d92a8d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ func (s *Stream) ClientConnectHook(fn func(*http.Request, *Client)) {
s.clientConnectHook = fn
}

// NumClients returns the number of currently connected clients
func (s *Stream) NumClients() int {
return len(s.clients)
}

// Checks that a client expects an event-stream
func checkRequest(r *http.Request) bool {
return r.Header.Get("Accept") == "text/event-stream"
Expand Down

0 comments on commit 8d92a8d

Please sign in to comment.