You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Clif Flynt <cl...@cflynt.com> on 2011/01/06 18:51:35 UTC

Apple Push Notification Service - existing code?

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.

  Thanks,
  Clif
-- 
... Clif Flynt ... http://www.cwflynt.com ... clif@cflynt.com ...
.. Tcl/Tk: A Developer's Guide (2nd edition) - Morgan Kauffman ..
.... 18'th Annual Tcl/Tk Conference:  2011, Manassas, VA USA ....
.............  http://www.tcl.tk/community/tcl2010/  ............







---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: Apple Push Notification Service - existing code?

Posted by Jeff Lawson <je...@bovine.net>.
On Thu, Jan 6, 2011 at 11:51 AM, Clif Flynt <cl...@cflynt.com> 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.