mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Splited Handler func + removed BiRPCRegister func
This commit is contained in:
committed by
Dan Christian Bogos
parent
37bac585ed
commit
0538c652d4
@@ -229,9 +229,7 @@ func (s *Server) ServeHTTP(addr string, jsonRPCURL string, wsRPCURL string,
|
||||
s.httpEnabled = true
|
||||
s.Unlock()
|
||||
utils.Logger.Info("<HTTP> enabling handler for WebSocket connections")
|
||||
wsHandler := websocket.Handler(func(ws *websocket.Conn) {
|
||||
rpc.ServeCodec(newCapsJSONCodec(ws, s.caps, s.anz))
|
||||
})
|
||||
wsHandler := websocket.Handler(s.handleWebSocket)
|
||||
if useBasicAuth {
|
||||
s.httpMux.HandleFunc(wsRPCURL, use(wsHandler.ServeHTTP, basicAuth(userList)))
|
||||
} else {
|
||||
@@ -413,6 +411,10 @@ func (s *Server) ServeJSONTLS(addr, serverCrt, serverKey, caCert string,
|
||||
s.serveCodecTLS(addr, utils.JSONCaps, serverCrt, serverKey, caCert, serverPolicy, serverName, newCapsJSONCodec, shdChan)
|
||||
}
|
||||
|
||||
func (s *Server) handleWebSocket(ws *websocket.Conn) {
|
||||
rpc.ServeCodec(newCapsJSONCodec(ws, s.caps, s.anz))
|
||||
}
|
||||
|
||||
func (s *Server) ServeHTTPTLS(addr, serverCrt, serverKey, caCert string, serverPolicy int,
|
||||
serverName string, jsonRPCURL string, wsRPCURL string,
|
||||
useBasicAuth bool, userList map[string]string, shdChan *utils.SyncedChan) {
|
||||
@@ -438,9 +440,7 @@ func (s *Server) ServeHTTPTLS(addr, serverCrt, serverKey, caCert string, serverP
|
||||
s.httpEnabled = true
|
||||
s.Unlock()
|
||||
utils.Logger.Info("<HTTPS> enabling handler for WebSocket connections")
|
||||
wsHandler := websocket.Handler(func(ws *websocket.Conn) {
|
||||
rpc.ServeCodec(newCapsJSONCodec(ws, s.caps, s.anz))
|
||||
})
|
||||
wsHandler := websocket.Handler(s.handleWebSocket)
|
||||
if useBasicAuth {
|
||||
s.httpsMux.HandleFunc(wsRPCURL, use(wsHandler.ServeHTTP, basicAuth(userList)))
|
||||
} else {
|
||||
|
||||
@@ -34,7 +34,6 @@ type Server interface {
|
||||
RegisterHttpFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
|
||||
RegisterHttpHandler(pattern string, handler http.Handler)
|
||||
BiRPCRegisterName(method string, handlerFunc interface{})
|
||||
BiRPCRegister(rcvr interface{})
|
||||
}
|
||||
|
||||
func LocalAddr() *NetAddr {
|
||||
|
||||
Reference in New Issue
Block a user