blob: 42b73730e7c3bf98c3126515f5bd4a5a4ed8b285 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package http
import (
"net/http"
)
// messages method used to read messages from the ws plugin with the auth requests for the topics and server
func (p *Plugin) messages() {
for msg := range p.hub.ReceiveCh() {
p.RLock()
// msg here is the structure with http.ResponseWriter and http.Request
rmsg := msg.(struct {
RW http.ResponseWriter
Req *http.Request
})
p.handler.ServeHTTP(rmsg.RW, rmsg.Req)
p.hub.SendCh() <- struct {
RW http.ResponseWriter
Req *http.Request
}{
rmsg.RW,
rmsg.Req,
}
p.RUnlock()
}
}
|