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