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 authored and GitHub committed 2022-08-05 09:24:47 -07:00
1 parent c75090a0fe
commit ab1ccae0c7
6 files changed
+46 -11

No files matched your search

+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)