First, in PROJECT.CLJ, add a reference to the Notnoop class library: [Com.notnoop.apns/apns "0.2.3"]
You can then send a push message using the following method:
1 (ns Demo.apns2 (: Import (Com.notnoop.apns APNs )))3 4 (defn send-push-notification5 [Device-tokens Message]6(Loop[Rest-device-tokens Device-tokens7Sent-count 0]8 (if (empty rest-device-tokens)9 Sent-countTen ( do One(Let[Service (. Build (. Withsandboxdestination A (. Withcert (Apns/newservice) -"RESOURCES/DEMO.P12" -"Password"))) the payload (. Build (. Alertbody (apns/newpayload) message))] - (. Push Service (first Rest-device-tokens) payload)) -(Recur (rest Rest-device-tokens) (inc Sent-count)))))
The calling method is as follows:
(Send-push-notification ["Token1" "Token2" ...] "Test Message")
Note that the certificate must be in P12 format (can be converted by Keychain Access software)