Skip to content

Commit 071cc31

Browse files
committed
Doc tweaks
1 parent 851b218 commit 071cc31

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"sync"
77
)
88

9+
// Client wraps an http connection and converts it to an
10+
// event stream.
911
type Client struct {
1012
flush http.Flusher
1113
write io.Writer
@@ -15,6 +17,10 @@ type Client struct {
1517
waiter sync.WaitGroup
1618
}
1719

20+
// Creates a client wrapping a response writer.
21+
// The response writer must support http.Flusher and http.CloseNotifier
22+
// interfaces.
23+
// Returns nil on error.
1824
func NewClient(w http.ResponseWriter) *Client {
1925
c := &Client{
2026
events: make(chan *Event, 1),

stream.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ func (s *Stream) TopicHandler(topics []string) http.HandlerFunc {
175175
}
176176

177177
// Register a function to be called when a client connects to this stream's
178-
// HTTP handler
178+
// HTTP handler.
179+
// Only one handler may be registered. Further calls overwrite the previous.
179180
func (s *Stream) ClientConnectHook(fn func(*http.Request, *Client)) {
180181
s.clientConnectHook = fn
181182
}

0 commit comments

Comments
 (0)