blob: 23b5ff3ecf579aef6e15d964833b0fbc1da4982d (
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
29
|
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.ToWorker() {
p.RLock()
// msg here is the structure with http.ResponseWriter and http.Request
rmsg := msg.(struct {
RW http.ResponseWriter
Req *http.Request
})
// invoke handler with redirected responsewriter and request
p.handler.ServeHTTP(rmsg.RW, rmsg.Req)
p.hub.FromWorker() <- struct {
RW http.ResponseWriter
Req *http.Request
}{
rmsg.RW,
rmsg.Req,
}
p.RUnlock()
}
}
|