<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Apple Push Notifications on Rails</title>
	<atom:link href="http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/</link>
	<description>The technical ramblings of Mark Bates.</description>
	<lastBuildDate>Wed, 17 Aug 2011 16:45:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: James N</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-223</link>
		<dc:creator>James N</dc:creator>
		<pubDate>Thu, 17 Sep 2009 09:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-223</guid>
		<description>Do you know if your plugin will allow for notifications to be sent for unlocked phones?  I heard that it doesn&#039;t always work with unlocked phones...any details on this subject? Thanks.</description>
		<content:encoded><![CDATA[<p>Do you know if your plugin will allow for notifications to be sent for unlocked phones?  I heard that it doesn&#8217;t always work with unlocked phones&#8230;any details on this subject? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Soffes</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-221</link>
		<dc:creator>Sam Soffes</dc:creator>
		<pubDate>Mon, 07 Sep 2009 06:32:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-221</guid>
		<description>Looks cool. Thanks for the kind words. Yours looks pretty cool.</description>
		<content:encoded><![CDATA[<p>Looks cool. Thanks for the kind words. Yours looks pretty cool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Bates</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-220</link>
		<dc:creator>Mark Bates</dc:creator>
		<pubDate>Thu, 27 Aug 2009 14:41:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-220</guid>
		<description>Hi Corey, I&#039;m glad you like the gem. I aim to please. :) 

I can&#039;t say I have those types of benchmarks, as I&#039;ve been working on a much smaller scale in terms of notifications. I designed the plugin to use normalized data, so I didn&#039;t have to keep storing redundant info in the notifications table. You could easily pull it all back in one query, if you think that&#039;s a bottleneck. What I can say is that pulling 10k records in 5 minutes with AR is totally doable, I don&#039;t think that&#039;s where any bottlenecks would occur. If you get some benchmarks I would love to see them.

As for storing byte arrays to AR, I&#039;m sure it&#039;s possible, again it&#039;s not something I&#039;ve had to do before with AR. If you want to fork the project on GitHub and can come up with some great performance enhancements that make sense, I&#039;ll gladly pull that back into the project. I love when others contribute and make the project better.</description>
		<content:encoded><![CDATA[<p>Hi Corey, I&#8217;m glad you like the gem. I aim to please. <img src='http://www.metabates.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>I can&#8217;t say I have those types of benchmarks, as I&#8217;ve been working on a much smaller scale in terms of notifications. I designed the plugin to use normalized data, so I didn&#8217;t have to keep storing redundant info in the notifications table. You could easily pull it all back in one query, if you think that&#8217;s a bottleneck. What I can say is that pulling 10k records in 5 minutes with AR is totally doable, I don&#8217;t think that&#8217;s where any bottlenecks would occur. If you get some benchmarks I would love to see them.</p>
<p>As for storing byte arrays to AR, I&#8217;m sure it&#8217;s possible, again it&#8217;s not something I&#8217;ve had to do before with AR. If you want to fork the project on GitHub and can come up with some great performance enhancements that make sense, I&#8217;ll gladly pull that back into the project. I love when others contribute and make the project better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Corey M</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-219</link>
		<dc:creator>Corey M</dc:creator>
		<pubDate>Thu, 27 Aug 2009 07:42:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-219</guid>
		<description>Hi Mark, First up thanks in advance for this wonderful gem, its fantastic how easy it is to get up and running.

I&#039;m wondering if you have any benchmarks for large scale notifications (say 10000 devices on 5 min intervals). I&#039;m wondering about the consequences of having a join to get to the device token when you could store the token as a 32 byte blob right on the notification. Some quick console hacking.

&gt;&gt; token_in = &quot;ffffffffdbc0ce239b3d15e96efe4525941ebb8d8b65bc241eceffffffffffff&quot; #Masked for security
=&gt; &quot;ffffffffdbc0ce239b3d15e96efe4525941ebb8d8b65bc241eceffffffffffff&quot;
&gt;&gt; token_in_int = &quot;0x#{token_in}&quot;.to_i(16)
=&gt; 111987304994859507620189752773925056744031439616140324133437380330181909811521
&gt;&gt; token_in_int.size
=&gt; 32
&gt;&gt; token_in.size
=&gt; 64
&gt;&gt; token_out = token_in_int.to_s(16)
=&gt; &quot;ffffffffdbc0ce239b3d15e96efe4525941ebb8d8b65bc241eceffffffffffff&quot;
&gt;&gt; token_out.scan(/......../).join(&quot; &quot;) == token_in.scan(/......../).join(&quot; &quot;)
=&gt; true

I&#039;m not sure how easy it is (or isn&#039;t) to attach a byte array to an AR::Base but for an app we&#039;re building we&#039;re dealing with a lot of notifications to a lot of devices so I&#039;m wondering if getting the token down to a 32 byte blob would make it easy to just tack it onto the notification and save a join in the query.

Just a thought,

Corey</description>
		<content:encoded><![CDATA[<p>Hi Mark, First up thanks in advance for this wonderful gem, its fantastic how easy it is to get up and running.</p>
<p>I&#8217;m wondering if you have any benchmarks for large scale notifications (say 10000 devices on 5 min intervals). I&#8217;m wondering about the consequences of having a join to get to the device token when you could store the token as a 32 byte blob right on the notification. Some quick console hacking.</p>
<p>&gt;&gt; token_in = &#8220;ffffffffdbc0ce239b3d15e96efe4525941ebb8d8b65bc241eceffffffffffff&#8221; #Masked for security<br />
=&gt; &#8220;ffffffffdbc0ce239b3d15e96efe4525941ebb8d8b65bc241eceffffffffffff&#8221;<br />
&gt;&gt; token_in_int = &#8220;0x#{token_in}&#8221;.to_i(16)<br />
=&gt; 111987304994859507620189752773925056744031439616140324133437380330181909811521<br />
&gt;&gt; token_in_int.size<br />
=&gt; 32<br />
&gt;&gt; token_in.size<br />
=&gt; 64<br />
&gt;&gt; token_out = token_in_int.to_s(16)<br />
=&gt; &#8220;ffffffffdbc0ce239b3d15e96efe4525941ebb8d8b65bc241eceffffffffffff&#8221;<br />
&gt;&gt; token_out.scan(/&#8230;&#8230;../).join(&#8221; &#8220;) == token_in.scan(/&#8230;&#8230;../).join(&#8221; &#8220;)<br />
=&gt; true</p>
<p>I&#8217;m not sure how easy it is (or isn&#8217;t) to attach a byte array to an AR::Base but for an app we&#8217;re building we&#8217;re dealing with a lot of notifications to a lot of devices so I&#8217;m wondering if getting the token down to a 32 byte blob would make it easy to just tack it onto the notification and save a join in the query.</p>
<p>Just a thought,</p>
<p>Corey</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Bates</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-208</link>
		<dc:creator>Mark Bates</dc:creator>
		<pubDate>Sat, 01 Aug 2009 23:28:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-208</guid>
		<description>Fabien, that&#039;s good to know. I know they like it when you bulk deliver, but I didn&#039;t think they would be good about having a persistent connection.

With the latest version, 0.3.0, I&#039;ve wrapped the connection stuff, so you could pretty easily have it run forever with something like this:

&lt;script src=&quot;http://gist.github.com/159858.js&quot;&gt;&lt;/script&gt;

I might put that in that version, a binary that you can run in the background that opens the connection and keeps polling for new notifications and delivers them.</description>
		<content:encoded><![CDATA[<p>Fabien, that&#8217;s good to know. I know they like it when you bulk deliver, but I didn&#8217;t think they would be good about having a persistent connection.</p>
<p>With the latest version, 0.3.0, I&#8217;ve wrapped the connection stuff, so you could pretty easily have it run forever with something like this:</p>
<p><script src="http://gist.github.com/159858.js"></script></p>
<p>I might put that in that version, a binary that you can run in the background that opens the connection and keeps polling for new notifications and delivers them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabien Penso</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-207</link>
		<dc:creator>Fabien Penso</dc:creator>
		<pubDate>Sat, 01 Aug 2009 22:25:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-207</guid>
		<description>Apple asks for it, they said they had no problem with you keeping connected during WWDC. That&#039;s what&#039;s my (private) version of my Rails plugin is doing, using backgroundrb. I just had no time to release it to the public as I want to first run my service, then I&#039;ll clean a bit of the code and release it on github.</description>
		<content:encoded><![CDATA[<p>Apple asks for it, they said they had no problem with you keeping connected during WWDC. That&#8217;s what&#8217;s my (private) version of my Rails plugin is doing, using backgroundrb. I just had no time to release it to the public as I want to first run my service, then I&#8217;ll clean a bit of the code and release it on github.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Bates</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-199</link>
		<dc:creator>Mark Bates</dc:creator>
		<pubDate>Mon, 27 Jul 2009 19:28:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-199</guid>
		<description>Carson I would love to see a project like that! The question is will Apple let you keep a connection open constantly like that? I suppose if it gets dropped you could detect it and re-open it. I still fear that they might not be too thrilled about an &#039;always-on&#039; connection.</description>
		<content:encoded><![CDATA[<p>Carson I would love to see a project like that! The question is will Apple let you keep a connection open constantly like that? I suppose if it gets dropped you could detect it and re-open it. I still fear that they might not be too thrilled about an &#8216;always-on&#8217; connection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carson McDonald</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-198</link>
		<dc:creator>Carson McDonald</dc:creator>
		<pubDate>Mon, 27 Jul 2009 17:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-198</guid>
		<description>Mark, yep that change to the README is what I was thinking. People should be somewhat careful sending the notifications as it seems there is some threshold that gets you shut down. 

I&#039;ve actually been thinking it would be nice if there was a module for something like RabbitMQ that would just keep a persistent connection open and let the user do the notifications using normal message queues and get removes via subscriptions.</description>
		<content:encoded><![CDATA[<p>Mark, yep that change to the README is what I was thinking. People should be somewhat careful sending the notifications as it seems there is some threshold that gets you shut down. </p>
<p>I&#8217;ve actually been thinking it would be nice if there was a module for something like RabbitMQ that would just keep a persistent connection open and let the user do the notifications using normal message queues and get removes via subscriptions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Bates</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-197</link>
		<dc:creator>Mark Bates</dc:creator>
		<pubDate>Mon, 27 Jul 2009 17:22:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-197</guid>
		<description>Carson, I also just updated the README to be a bit more explicit about this: 

&lt;pre&gt;&lt;code&gt;
  $ ./script/console
  &gt;&gt; device = APN::Device.create(:token =&gt; &quot;XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX&quot;)
  &gt;&gt; notification = APN::Notification.new
  &gt;&gt; notification.device = device
  &gt;&gt; notification.badge = 5
  &gt;&gt; notification.sound = true
  &gt;&gt; notification.alert = &quot;foobar&quot;
  &gt;&gt; notification.save
&lt;/code&gt;&lt;/pre&gt;

You can use the following Rake task to deliver your notifications:
&lt;pre&gt;&lt;code&gt;
  $ rake apn:notifications:deliver
&lt;/code&gt;&lt;/pre&gt;

The Rake task will find any unsent notifications in the database. If there aren&#039;t any notifications
it will simply do nothing. If there are notifications waiting to be delivered it will open a single connection
to Apple and push all the notifications through that one connection. Apple does not like people opening/closing
connections constantly, so it&#039;s pretty important that you are careful about batching up your notifications so
Apple doesn&#039;t shut you down.</description>
		<content:encoded><![CDATA[<p>Carson, I also just updated the README to be a bit more explicit about this: </p>
<pre><code>
  $ ./script/console
  >> device = APN::Device.create(:token => "XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX")
  >> notification = APN::Notification.new
  >> notification.device = device
  >> notification.badge = 5
  >> notification.sound = true
  >> notification.alert = "foobar"
  >> notification.save
</code></pre>
<p>You can use the following Rake task to deliver your notifications:</p>
<pre><code>
  $ rake apn:notifications:deliver
</code></pre>
<p>The Rake task will find any unsent notifications in the database. If there aren&#8217;t any notifications<br />
it will simply do nothing. If there are notifications waiting to be delivered it will open a single connection<br />
to Apple and push all the notifications through that one connection. Apple does not like people opening/closing<br />
connections constantly, so it&#8217;s pretty important that you are careful about batching up your notifications so<br />
Apple doesn&#8217;t shut you down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Bates</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/comment-page-1/#comment-196</link>
		<dc:creator>Mark Bates</dc:creator>
		<pubDate>Mon, 27 Jul 2009 17:17:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.metabates.com/?p=250#comment-196</guid>
		<description>Hey Carson, not to worry it doesn&#039;t make a call to Apple for every message. When you call APN::Notifications.send_notifications it finds all the unsent messages in the db. If there are messages that need to be sent, then it opens up one connection to Apple and pushes all the notifications through that. If there aren&#039;t any messages, then it does nothing. Of course, it is possible to call that method after you create a new notification, but there&#039;s not much I can do about that. Apple will shut those people down pretty quickly for constantly opening/closing connections.

Does that answer your question?</description>
		<content:encoded><![CDATA[<p>Hey Carson, not to worry it doesn&#8217;t make a call to Apple for every message. When you call APN::Notifications.send_notifications it finds all the unsent messages in the db. If there are messages that need to be sent, then it opens up one connection to Apple and pushes all the notifications through that. If there aren&#8217;t any messages, then it does nothing. Of course, it is possible to call that method after you create a new notification, but there&#8217;s not much I can do about that. Apple will shut those people down pretty quickly for constantly opening/closing connections.</p>
<p>Does that answer your question?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.745 seconds -->
<!-- Cached page served by WP-Cache -->

