mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
api, metrics: add endpoints and metrics for RTSP connections (#1233)
new API endpoints: * /v1/rtspconns/list * /v1/rtspsconns/list new metrics: * rtsp_conns * rtsps_conns
This commit is contained in:
parent
16580c8985
commit
4ac175d3cc
12 changed files with 291 additions and 109 deletions
|
|
@ -314,8 +314,11 @@ func (s *rtmpServer) connClose(c *rtmpConn) {
|
|||
}
|
||||
|
||||
// apiConnsList is called by api.
|
||||
func (s *rtmpServer) apiConnsList(req rtmpServerAPIConnsListReq) rtmpServerAPIConnsListRes {
|
||||
req.res = make(chan rtmpServerAPIConnsListRes)
|
||||
func (s *rtmpServer) apiConnsList() rtmpServerAPIConnsListRes {
|
||||
req := rtmpServerAPIConnsListReq{
|
||||
res: make(chan rtmpServerAPIConnsListRes),
|
||||
}
|
||||
|
||||
select {
|
||||
case s.chAPIConnsList <- req:
|
||||
return <-req.res
|
||||
|
|
@ -326,8 +329,12 @@ func (s *rtmpServer) apiConnsList(req rtmpServerAPIConnsListReq) rtmpServerAPICo
|
|||
}
|
||||
|
||||
// apiConnsKick is called by api.
|
||||
func (s *rtmpServer) apiConnsKick(req rtmpServerAPIConnsKickReq) rtmpServerAPIConnsKickRes {
|
||||
req.res = make(chan rtmpServerAPIConnsKickRes)
|
||||
func (s *rtmpServer) apiConnsKick(id string) rtmpServerAPIConnsKickRes {
|
||||
req := rtmpServerAPIConnsKickReq{
|
||||
id: id,
|
||||
res: make(chan rtmpServerAPIConnsKickRes),
|
||||
}
|
||||
|
||||
select {
|
||||
case s.chAPIConnsKick <- req:
|
||||
return <-req.res
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue