Giter Club home page Giter Club logo

Comments (3)

andrei-m-code avatar andrei-m-code commented on May 28, 2024

very strange.. the version 3.1.1 works well for me. It seems like it's a parsing error for when the response is received from the APN server. I wonder what it is.. Would be good to debug it. I'd be curious to see what you get in ApnSender in the line:

var content = await response.Content.ReadAsStringAsync();

from net-core-push-notifications.

Thomr77 avatar Thomr77 commented on May 28, 2024

Hey @andrei-m-code!

Okay I spent some time with it - you are right, it seems to fail when the error is parsed:

using (var response = await http.SendAsync(message, cancellationToken))
{
    var succeed = response.IsSuccessStatusCode;
    var content = await response.Content.ReadAsStringAsync();
    var error = JsonHelper.Deserialize<ApnsError>(content); <-- Here

    return new ApnsResponse
    {
        IsSuccess = succeed,
        Error = error
    };
}

The Content I got is the following:

<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/3/device/C689B30554D56AAD13ED65D7D305C85235F79029233997D98484C0537F3183A6</code> was not found on this server.  <ins>That’s all we know.</ins>

I did this several times and every time the same html came back with Google references (sending via Apple), also not sure why the html is not closed...but I am unsure what the format is supposed to be of these.

Does this point you in the right direction?
Thanks!

from net-core-push-notifications.

Thomr77 avatar Thomr77 commented on May 28, 2024

Hey @andrei-m-code!

I spent some more time on it and found the issue!

Basically, I have shared the same HttpClient instance with FcmSender and ApnSender which has worked fine up until 3.1.0.

But with 3.1.1 the HttpClient BaseAddress is now set within the FcmSender and ApnSender constructors once, while the previous version did that during sending every time (within the SendAsync function) - so that was it!

For anyone who has the same issue - simply use a separate HttpClient instance for FcmSender and ApnSender.
Thanks!

from net-core-push-notifications.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.