mirror of
https://github.com/Sneed-Group/pypush-plus-plus
synced 2024-12-24 11:52:27 -06:00
changes
This commit is contained in:
parent
196feb2cc8
commit
8f5e64e4b1
2 changed files with 7 additions and 1 deletions
1
apns.py
1
apns.py
|
@ -39,6 +39,7 @@ COMMANDS = {
|
|||
0x8: "ConnectResponse",
|
||||
0x9: "PushTopics",
|
||||
0x0A: "PushNotification",
|
||||
0x0B: "Acknowledge",
|
||||
}
|
||||
|
||||
class Payload:
|
||||
|
|
7
demo.py
7
demo.py
|
@ -23,11 +23,16 @@ expiry = expiry.to_bytes(4, "big")
|
|||
# Current time in UNIX nano epoch
|
||||
import time
|
||||
now = int(time.time() * 1000).to_bytes(8, "big")
|
||||
payload = apns.Payload(0x0a, apns.Fields({1: sha1(b"com.apple.madrid").digest(), 2: conn2.token, 3: b"Hello World!", 5: expiry, 6: now, 7: 0x00.to_bytes()}))
|
||||
|
||||
payload = apns.Payload(0x0a, apns.Fields({1: sha1(b"com.apple.madrid").digest(), 2: conn2.token, 3: b"Hello World!", 4: 0x00.to_bytes(), 5: expiry, 6: now, 7: 0x00.to_bytes()}))
|
||||
conn1.sock.write(payload.to_bytes())
|
||||
|
||||
print("Waiting for response...")
|
||||
|
||||
# Check if the notification was sent
|
||||
resp = apns.Payload.from_stream(conn1.sock)
|
||||
print(resp)
|
||||
|
||||
# Read the message from the other connection
|
||||
resp = apns.Payload.from_stream(conn2.sock)
|
||||
print(resp)
|
Loading…
Reference in a new issue