snnagar / apns-sharp

Automatically exported from code.google.com/p/apns-sharp
0 stars 0 forks source link

Notification Worker Method improvements #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
workerMethod has an issue when you are sending a bulk of notifications,
apnsStream.Write will write the entire byte[] buffer stream out, sending
null characters to the underlying stream. This causes issues when trying to
send a mass of notifications. 

Suggestion would be have the Notification Build method return the length of
the byte array that it has filled out. At the end of the BuildPayload
method, return return 37 + payload.Length and you will have the entire length.

I tested this and using:

apnsStream.Write(buffer, 0, length);
apnsStream.Flush();

Before I made the change, it would clog up around 100 notifications due to
APNS closing the connection. I can send (tested with) 2000 in <2 seconds
with the change.

Original issue reported on code.google.com by h3sm...@gmail.com on 7 Oct 2009 at 5:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This is now fixed in the latest commit.

There's a lot of changes, and one of them is that there is no hard coded buffer
length (I misunderstood the specs previously).  Now it should work :)

Original comment by jond...@gmail.com on 22 Dec 2009 at 5:42