Respond to signal ping / pong (#871)

* Respond to signal ping / pong

* Pass back 1 for pong for now, we don't need the timestamp

* update protocol
This commit is contained in:
David Zhao
2022-08-05 09:24:47 -07:00
committed by GitHub
parent c75090a0fe
commit ab1ccae0c7
6 changed files with 46 additions and 11 deletions
+3
View File
@@ -54,6 +54,9 @@ func (p *ParticipantImpl) SendJoinResponse(
// indicates both server and client support subscriber as primary
SubscriberPrimary: p.SubscriberAsPrimary(),
ClientConfiguration: p.params.ClientConf,
// sane defaults for ping interval & timeout
PingInterval: 10,
PingTimeout: 20,
},
},
})
+8
View File
@@ -256,6 +256,14 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
}
if _, ok := req.Message.(*livekit.SignalRequest_Ping); ok {
_ = sigConn.WriteResponse(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Pong{
Pong: 1,
},
})
continue
}
if err := reqSink.WriteMessage(req); err != nil {
pLogger.Warnw("error writing to request sink", err,
"connID", connId)