File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 6
6
"sync"
7
7
)
8
8
9
+ // Client wraps an http connection and converts it to an
10
+ // event stream.
9
11
type Client struct {
10
12
flush http.Flusher
11
13
write io.Writer
@@ -15,6 +17,10 @@ type Client struct {
15
17
waiter sync.WaitGroup
16
18
}
17
19
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.
18
24
func NewClient (w http.ResponseWriter ) * Client {
19
25
c := & Client {
20
26
events : make (chan * Event , 1 ),
Original file line number Diff line number Diff line change @@ -175,7 +175,8 @@ func (s *Stream) TopicHandler(topics []string) http.HandlerFunc {
175
175
}
176
176
177
177
// 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.
179
180
func (s * Stream ) ClientConnectHook (fn func (* http.Request , * Client )) {
180
181
s .clientConnectHook = fn
181
182
}
You can’t perform that action at this time.
0 commit comments