send ACKs so it shows as Delivered

This commit is contained in:
JJTech0130 2023-07-25 19:07:29 -04:00
parent 9be46ffcab
commit baf922af61
No known key found for this signature in database
GPG key ID: 23C92EBCCF8F93D6
2 changed files with 6 additions and 4 deletions

View file

@ -238,10 +238,10 @@ class APNSConnection:
logger.debug("Sending keep alive message") logger.debug("Sending keep alive message")
self.sock.write(_serialize_payload(0x0C, [])) self.sock.write(_serialize_payload(0x0C, []))
# def _send_ack(self, id: bytes): def _send_ack(self, id: bytes):
# print(f"Sending ACK for message {id}") logger.debug(f"Sending ACK for message {id}")
# payload = _serialize_payload(0x0B, [(1, self.token), (4, id), (8, b"\x00")]) payload = _serialize_payload(0x0B, [(1, self.token), (4, id), (8, b"\x00")])
# self.sock.write(payload) self.sock.write(payload)
# #self.sock.write(_serialize_payload(0x0B, [(4, id)]) # #self.sock.write(_serialize_payload(0x0B, [(4, id)])
# #pass # #pass

View file

@ -233,6 +233,8 @@ while True:
return True return True
payload = conn.incoming_queue.wait_pop_find(check_response) payload = conn.incoming_queue.wait_pop_find(check_response)
resp_body = apns._get_field(payload[1], 3) resp_body = apns._get_field(payload[1], 3)
id = apns._get_field(payload[1], 4)
conn._send_ack(id)
resp_body = plistlib.loads(resp_body) resp_body = plistlib.loads(resp_body)
#logging.info(f"Got response: {resp_body}") #logging.info(f"Got response: {resp_body}")
payload = resp_body["P"] payload = resp_body["P"]