On Thu, Jan 6, 2011 at 11:51 AM, Clif Flynt <[email protected]> wrote:
> Hi,
> The thing I'm doing with rivet delivers info via html to a browser
> or via xml to an iPhone app.
>
> The next step is sending Apple Push Notifications when something new
> pops up.
>
> Has anyone played with APNS and Rivet?
>
> I'm finding plenty of info about PHP support, so I can certainly
> retro-engineer something, but I'll be happy to steal code rather than
> re-write it.
>
>
I wrote some code to send APNS messages to the Apple server by opening a
tls::socket to their port and using Tcl file events to read/write the binary
packets. You can use "binary scan" to parse the messages from the Apple
feedback server, and "binary format" to build the outgoing messages to the
Apple gateway server.
set msg [binary format "cSH*Sa*" 0 [expr [string length $deviceToken]/2]
$deviceToken [string length $payload] $payload]
We're not actually doing any of this inside of a Rivet process, since we
wanted to send things in batches from a separate Tcl daemon and keep a
semi-persistent TCP connection open to the APNS server.