webpush notification pwa exception
Budget: $30 – $250 USD
i have a project working fine but some times this project throw exception as following
Description: The process was terminated due to an unhandled exception.
Exception Info: WebPush.WebPushException
at WebPush.WebPushClient.HandleResponse(System.Net.Http.HttpResponseMessage, WebPush.PushSubscription)
at WebPush.WebPushClient.SendNotification(WebPush.PushSubscription, System.String, System.Collections.Generic.Dictionary`2<System.String,System.Object>)
at ApiMethods.SendPush(WebPush.PushSubscription, System.String, WebPush.VapidDetails)
at ApiMethods+<>c__DisplayClass11_0.<pushNotification>b__0()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
------------------
and this one also
WebPush.WebPushException
Message: Subscription no longer valid. Details: push subscription has unsubscribed or expired.
StackTrace: at WebPush.WebPushClient.HandleResponse(HttpResponseMessage response, PushSubscription subscription)
at WebPush.WebPushClient.SendNotification(PushSubscription subscription, String payload, Dictionary`2 options)
at ApiMethods.SendPush(PushSubscription pushSubscription, String payloadString, VapidDetails vapidDetails) in C:\.............\ApiMethods.cs:line 350
at ApiMethods.<>c__DisplayClass11_0.<pushNotification>b__0() in C:\.............\ApiMethods.cs:line 370
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
----
it happened when i click send sometimes
the code is here
void SendPush(PushSubscription pushSubscription, string payloadString, VapidDetails vapidDetails)
{
var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(15);
var webPushClient = new WebPushClient(httpClient);
webPushClient.SendNotification(pushSubscription, payloadString, vapidDetails); //line 350
}
public string pushNotification(payload objpayload, userinfo objuser)
{
string outcome = "N";
try
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string payloadString = serializer.Serialize(objpayload);
string publicKey = VapidKeys.publicKey;
string privateKey = VapidKeys.privateKey;
string subject = VapidKeys.subject;
var pushSubscription = new PushSubscription(objuser.PushEndpoint, objuser.PushP256DH, objuser.PushAuth);
var vapidDetails = new VapidDetails("" + subject, publicKey, privateKey);
Thread thread = new Thread(() => SendPush(pushSubscription, payloadString, vapidDetails)); // line 370
thread.Start();
outcome = "Y";
}
catch (Exception ex)
{
//outcome += ex.Message.ToString() + " " + ex.StackTrace.ToString();
}
return outcome;
}
-------------
kindly read the whole project if you can solve the issue just send to chatbox , no need for more explenation from your side
project built in asp.net c# web form
suggested amount for the project is 45$
Description: The process was terminated due to an unhandled exception.
Exception Info: WebPush.WebPushException
at WebPush.WebPushClient.HandleResponse(System.Net.Http.HttpResponseMessage, WebPush.PushSubscription)
at WebPush.WebPushClient.SendNotification(WebPush.PushSubscription, System.String, System.Collections.Generic.Dictionary`2<System.String,System.Object>)
at ApiMethods.SendPush(WebPush.PushSubscription, System.String, WebPush.VapidDetails)
at ApiMethods+<>c__DisplayClass11_0.<pushNotification>b__0()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
------------------
and this one also
WebPush.WebPushException
Message: Subscription no longer valid. Details: push subscription has unsubscribed or expired.
StackTrace: at WebPush.WebPushClient.HandleResponse(HttpResponseMessage response, PushSubscription subscription)
at WebPush.WebPushClient.SendNotification(PushSubscription subscription, String payload, Dictionary`2 options)
at ApiMethods.SendPush(PushSubscription pushSubscription, String payloadString, VapidDetails vapidDetails) in C:\.............\ApiMethods.cs:line 350
at ApiMethods.<>c__DisplayClass11_0.<pushNotification>b__0() in C:\.............\ApiMethods.cs:line 370
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
----
it happened when i click send sometimes
the code is here
void SendPush(PushSubscription pushSubscription, string payloadString, VapidDetails vapidDetails)
{
var httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(15);
var webPushClient = new WebPushClient(httpClient);
webPushClient.SendNotification(pushSubscription, payloadString, vapidDetails); //line 350
}
public string pushNotification(payload objpayload, userinfo objuser)
{
string outcome = "N";
try
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string payloadString = serializer.Serialize(objpayload);
string publicKey = VapidKeys.publicKey;
string privateKey = VapidKeys.privateKey;
string subject = VapidKeys.subject;
var pushSubscription = new PushSubscription(objuser.PushEndpoint, objuser.PushP256DH, objuser.PushAuth);
var vapidDetails = new VapidDetails("" + subject, publicKey, privateKey);
Thread thread = new Thread(() => SendPush(pushSubscription, payloadString, vapidDetails)); // line 370
thread.Start();
outcome = "Y";
}
catch (Exception ex)
{
//outcome += ex.Message.ToString() + " " + ex.StackTrace.ToString();
}
return outcome;
}
-------------
kindly read the whole project if you can solve the issue just send to chatbox , no need for more explenation from your side
project built in asp.net c# web form
suggested amount for the project is 45$