Skip to content

Commit 58905d8

Browse files
committed
Connect hook
1 parent d8f958f commit 58905d8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stream.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ func (s *Stream) ServeHTTP(w http.ResponseWriter, r *http.Request) {
131131

132132
// wait for the client to exit or be shutdown
133133
s.Register(c)
134+
if s.clientConnectHook != nil {
135+
s.clientConnectHook(r, c)
136+
}
134137
c.Wait()
135138
s.Remove(c)
136139
}
@@ -161,6 +164,10 @@ func (s *Stream) TopicHandler(topics []string) http.HandlerFunc {
161164
s.Subscribe(topic, c)
162165
}
163166

167+
if s.clientConnectHook != nil {
168+
s.clientConnectHook(r, c)
169+
}
170+
164171
// wait for the client to exit or be shutdown
165172
c.Wait()
166173
s.Remove(c)

0 commit comments

Comments
 (0)