mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2025-01-09 17:33:47 +00:00
give up on proper ACKing
This commit is contained in:
parent
9822d6f66f
commit
d908e9cc37
2 changed files with 8 additions and 1 deletions
8
apns.py
8
apns.py
|
@ -126,6 +126,12 @@ class APNSConnection:
|
||||||
|
|
||||||
self._incoming_queue.append(payload)
|
self._incoming_queue.append(payload)
|
||||||
|
|
||||||
|
# TODO: Hack: Send an ACK if this is a notification
|
||||||
|
# We do this because as of now pypush does not handle all incoming notifications
|
||||||
|
# and if you do not ACK a notification, APNs will keep resending it and eventually kill the connection
|
||||||
|
if payload.id == 0xA:
|
||||||
|
await self._send_ack(payload.fields_with_id(4)[0].value)
|
||||||
|
|
||||||
# Signal to any waiting tasks that we have a new payload
|
# Signal to any waiting tasks that we have a new payload
|
||||||
self._queue_park.set()
|
self._queue_park.set()
|
||||||
self._queue_park = trio.Event() # Reset the event
|
self._queue_park = trio.Event() # Reset the event
|
||||||
|
@ -292,7 +298,7 @@ class APNSConnection:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
r = await self._receive(0xA, f)
|
r = await self._receive(0xA, f)
|
||||||
await self._send_ack(r.fields_with_id(4)[0].value)
|
#await self._send_ack(r.fields_with_id(4)[0].value)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
async def set_state(self, state: int):
|
async def set_state(self, state: int):
|
||||||
|
|
1
demo.py
1
demo.py
|
@ -139,6 +139,7 @@ async def main():
|
||||||
|
|
||||||
# Send a message to myself
|
# Send a message to myself
|
||||||
await im.send(imessage.iMessage.create(im, "Hello, world!", [user.current_handle]))
|
await im.send(imessage.iMessage.create(im, "Hello, world!", [user.current_handle]))
|
||||||
|
print(await im.receive())
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import trio
|
import trio
|
||||||
|
|
Loading…
Reference in a new issue