Pr0Ger / PyAPNs2

Python library for interacting with the Apple Push Notification service (APNs) via HTTP/2 protocol
MIT License
349 stars 179 forks source link

Error occurred StreamResetError #116

Closed ALeksandr-Fuze closed 4 years ago

ALeksandr-Fuze commented 4 years ago

Hi, sometimes I get this error: StreamResetError what I do wrong or why it's happening? hyper/http20/connection.py in _get_stream at line 289

def _get_stream(self, stream_id):
    if stream_id is None:
        return self.recent_stream
    elif stream_id in self.reset_streams or stream_id not in self.streams:
        raise StreamResetError("Stream forcefully closed")
    else:
        return self.streams[stream_id]

when calls:

...
payload = Payload(custom=data['data'], sound="default", badge=1)
notifications = [Notification(payload=payload, token=t) for t in tokens]
resp = client.send_notification_batch(notifications=notifications, topic=topic, expiration=0)
captainkirkwood commented 4 years ago

@ALeksandr-Fuze are you able to comment on why this issue was closed?

We recently started encountering what appears to be the same issue. This was after sending millions of notifications without error over a period of many months, so we're quite certain the problem is not due to a bad certificate (which seems to be the most common cause of this kind of problem, judging by other issues).