From 4fbdbb15cced7fca1c165f7b1b23f30afc06e42a Mon Sep 17 00:00:00 2001 From: imbytecat Date: Tue, 27 Aug 2024 15:30:34 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/handler/onvif/subscription.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/router/handler/onvif/subscription.go b/router/handler/onvif/subscription.go index c5ab017..d4585d5 100644 --- a/router/handler/onvif/subscription.go +++ b/router/handler/onvif/subscription.go @@ -17,13 +17,13 @@ func CreateSubscription(c *gin.Context) { callbackURL := event.AttributedURIType(fmt.Sprintf("%s/onvif/subscriptions/%s/callback", config.Config.App.URL, xaddr)) log.Printf("CreateSubscription callback URL: %s", callbackURL) - conn := onvif.Sessions[xaddr] - if conn == nil { + session := onvif.Sessions[xaddr] + if session == nil { response.NewResponse().Fail("Connection not found").WithCode(http.StatusNotFound).Send(c) return } - result, err := conn.EventSubscribe(callbackURL, "PT60S") + result, err := session.EventSubscribe(callbackURL, "PT60S") if err != nil { response.NewResponse().Error(err).Send(c) return @@ -45,9 +45,5 @@ func NotifyCallback(c *gin.Context) { onvif.Notifications[xaddr] = append(onvif.Notifications[xaddr], notify.NotificationMessage...) - //for _, msg := range envelope.Body.Content.(*event.Notify).NotificationMessage { - // log.Printf("Topic: %s, Message: %s", msg.Topic.TopicKinds, msg.Message.Message) - //} - response.NewResponse().Success().Send(c) }