

Build a realtime liveblog with RethinkDB and PubNub - TheMissingPiece
http://rethinkdb.com/blog/rethinkdb-pubnub/

======
nacs
Using a locally-hosted database to send a realtime feed up to a remote Pubnub
server to have Pubnub send data back down to your visitors seems unnecessarily
complex.

There are plenty of standalone websocket (relay) servers if your language of
choice doesn't implement Websockets well. Also if you're using nginx, you have
built-in modules like pushstream that can handle it from the nginx side.

Considering the biggest selling point of RethinkDB is to provide realtime
updates faster than other solutions, putting Pubnub is not just slowing the
real-time system down but adding extra monetary cost.

~~~
segphault
Most of the demos that we publish at RethinkDB use Socket.io or some other
similar WebSocket abstraction layer, catering to cases where the user wants to
fully host the entire application from end to end.

But scaling a Socket.io application is not trivial, there are users who want a
hosted solution for realtime streams so that they don't have to worry about
their application falling over if they get too many simultaneous connections.

Granted, the case in the blog post is perhaps a bit contrived. But consider,
for example, a scenario where you take a single page web application, deploy
it to a CDN, and have all the realtime traffic that it accommodates routed
through PubNub's infrastructure. You could make it so that no traffic is
hitting your own servers, and you are just broadcasting updates into the
PubNub stream from your RethinkDB-based backend. That would be pretty trivial
to scale.

And in terms of the speed at which the messages are routed, for the purposes
of a liveblog or something of that nature, pushing everything through PubNub
isn't noticeably slower than using Socket.io.

Of course, nobody's saying that you should always use PubNub. As I said, we
often use Socket.io ourselves. But I do think there is legitimate value in
presenting it as an available option.

~~~
harlanji
> But scaling a Socket.io application is not trivial, there are users who want
> a hosted solution for realtime streams so that they don't have to worry
> about their application falling over if they get too many simultaneous
> connections.

PubNub employee here, I agree, this is the reason.

> And in terms of the speed at which the messages are routed, for the purposes
> of a liveblog or something of that nature, pushing everything through PubNub
> isn't noticeably slower than using Socket.io.

We aim for 1/4 second global latency (averaging 151ms currently
[http://status.pubnub.com/](http://status.pubnub.com/)).

Great demo!

------
cdnsteve
While I love technical articles such as this it saddens me there is always a
gap providing a working example. All code an no visuals mean most people won't
try it. Please give us a URL to play with, or at minimum, animated gif to see
this. I often find this with well written technical articles, open source
projects, etc. Folks are excited to go over code detail but never show us the
_demo_. You'll get more uptake since the hard work is already done!

~~~
TheMissingPiece
Hello :) I work on the community team at RethinkDB and we're working with
PubNub to host a meetup here in the bay area where we'll do a live demo and
presentation of this blog post. We record all the talks, too, so hopefully
we'll get this going sometime soon. Definitely understand where you're coming
from though.

~~~
cdnsteve
Hey right on, thanks for that. It's a great read and can't wait to see it in
action :)

