我正在使用Webpush库向web应用程序发送webpush通知,我已经开发了用于发送推送通知的API,在命令API中有一个名为 SendNotification 的库中的方法,没有响应即将到来。[ [1]:https://i.stack.imgur.com/fuwpP.png][1]
public HttpResponseMessage sendNotification(Notification notify)
{
try
{
var subscription = new PushSubscription(notify.endPoint, notify.p256dh, notify.auth);
if (subscription != null)
{
client.SendNotification(subscription, "clarifide notification received");
return Request.CreateResponse(HttpStatusCode.OK, notify);
}
else
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Internal Server Error");
}
}
catch (WebPushException e)
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message);
}
}