
Show HN: Run your own Push/Pull service for free using node.js + socket.io - daraosn
https://github.com/daraosn/node-puller
======
peteforde
There is nothing free about managing and supporting a complex infrastructure
component.

When you're building out an already sophisticated application, and your core
user value proposition has nothing to do with providing subscribed socket
connections then it is suddenly a real joy to pay real money to a competent
vendor that takes responsibility for something that is hard to get right.

Tech startups are 10% software and 90% running a business. Pusher helps me run
my business.

~~~
peteforde
As an addendum, my investors and board appreciate this thinking. "I can do all
of this myself" is a common ego trap that precedes cowboy mentality. Running a
socket stack sounds like fun until something goes wrong at 3am.

~~~
daraosn
This took 5 hours of coding and it's been running 2 months without problems,
where is the complexity of it??

I agree your point when you talk about really complex stuff, but something
that be done in that amount time doesn't worth to be outsourced in my opinion.

Also it's good to have alternatives, that's how we make things better.

~~~
rlivsey
Pusher costs ~$49/month, my time is worth $1000/hour [1]

It took me about 5 minutes to setup Pusher and for that I get private
channels, presence, someone to handle the scaling etc... as djb_hackernews
already mentioned.

We outsource DNS, email, hosting infrastructure, anything I possibly can which
isn't core to the product itself.

The question shouldn't be why outsource this, the question is why would it be
worth our time writing and supporting it ourselves when we can be working on
other things?

Maybe we'll insource this stuff when we're at a point where we hit the
'enterprise' plan on Pusher, when we have a few more developers and a
dedicated sys-admin. I'll cross that bride then, in the meantime I'm happy to
have a $49/m hit on my credit card and move onto the next thing!

All that aside, it's great to have options so thanks for releasing this!

[1] - <http://blog.asmartbear.com/value-time.html>

~~~
reitzensteinm
Wait, there's a difference between concentrating on tasks that you reasonably
expect to yield $1000 an hour, and spending $1000 here and now to save an
hour.

If there were two services, say an email support answering service, one
requiring $50 a month and 2 hours of your time, and one requiring $1000 a
month and 1 hour of your time, are you really saying you'd choose option #2?

I don't think that's in the spirit of the original blog post. It stipulated
the example current, risk free value of time as $150, which is probably more
accurate, and that would be the figure you'd use to make decisions like this.

In other words, spend an hour to save $150 today, or spend an hour to possibly
make $1000 two years from now.

(But I agree with the rest of your post, FWIW)

~~~
polynomial
> are you really saying you'd choose option #2?

This is such a great point. Because there is a _world_ of difference between
saying your time is worth $1k/hr, and walking the talk, as the phrase goes.

------
Argorak
For what its worth: if you want to have your own pusher, you can use Slanger.

<https://github.com/stevegraham/slanger>

It works with most (if not all) pusher libs and is rather convenient (except
the "run on your own infrastructure" part).

~~~
djb_hackernews
I also built my own Pusher compatible clone,
<https://github.com/danbeaulieu/PushPlay> which is built on the Play!
framework. Not recommended for production deployments, yet.

------
djb_hackernews
Nice work.

To be fair, you should list the things it can't do that Pusher can before you
advise people to forget it. It looks like node-puller:

* Doesn't scale

* Doesn't have authentication

* Doesn't have private channels

* Can't do presence

~~~
daraosn
Not yet... I shared this for two reasons, because is an open-source project
and so anyone can contribute to implement what is missing. Thanks, will
include your list in the README.

------
rohitnair
Kudos for sharing this and showing how easy it is to use node.js and socket.io
(for those who haven't tried out socket.io, you really should) I implemented
something similar for my side project recently, but instead of using an HTTP
end point, I used redis and it's in built pub/sub layer. Pushing events is
then a simple matter of publishing messages on redis channels. My node.js code
listens to these redis channels and pushes the events upstream to the browsers
via websockets, exactly as you do.

Another thing I'd suggest you to highlight (or rather warn) is your use of
eval. In the use cases you've mentioned (message board or chat room), you're
essentially going to eval user input. Any attacker who knows this will most
definitely try to perform XSS.

------
angersock
Congratulations on a cool project!

There seem to be a lot of people here who are wondering why you bothered doing
this instead of buying/renting/paying for some other solution. I'd suggest
quietly acknowledging their points, and then going back to working on cool
things.

Be an engineer. Be a problem-solver. Be a thinker. Don't worry about some
magical valuation of your time and how learning to roll-your-own is just
cowboy development--that's bullshit the suits will feed you to try and make
you reliant on their capital. Do the hard things, and you'll go far.

(oh, and look into em-websockets...some cool stuff there if you don't want to
mess with a full Rails deployment)

~~~
peteforde
You busted me! I'm a suit:

<https://vimeo.com/4031833>

I fail to understand how delegation is not problem solving, but I know that it
is most certainly smart business. Engineers need to manage their time and
their priorities, and building a socket queue is a solved problem if you let
it be. Why not spend that energy on UX?

~~~
angersock
Sir, you have fantastic moves. :)

About UX: that's an issue for the designers, yeah? I imagine the wheel-
reinvention should be left to your engineers.

In general, I'd agree with you delegation is a good idea, but if you look at
the site for the OP, it's a hackathon site. My assumption is that daraosn is
more on the dev side of the dev-biz spectrum.

It's really counterproductive and harmful to the dev ecosystem to keep
pointing out that whatever we're working on, well, it already exists, and we
just have to pay for it and move on. That's just my opinion, mind you, but I
hope some share it.

At the end of the day, we already have operating systems. And web stacks. And
programming languages. Anything you pick, anything at all you use for your
business, has probably been done before and probably better. We stand on the
shoulders of giants.

That said, it's important sometimes to reinvent the wheel. It's important to
scratch tech itches, even if your biz guys are breathing down your neck and
trying to convince you that you're wasting time and investor money.

The big problem I have, as a developer, is that there _are_ a lot of paid
services to solve problems. But, sometimes, they don't work, or they have bad
APIs, or they get acquired and go away.

Moreover, every time I outsource part of my stack, I'm reinforcing to the biz
guys "Hey, us devs? Yeah, we're just cogs. Find somebody else to replace my
sliver of logic integrating all these off-the-shelf APIs. I'm not really that
important."

How much progress in tech has been made by people reinventing the wheel?

~~~
StavrosK
This[1] was the most fun I've had in ages. MongoDB already exists, but this
was just a blast to write and is great to use. I agree with both you and
peterforde, you guys are really arguing about orthogonal issues.

[1] <https://github.com/stochastic-technologies/goatfish>

------
sjtgraham
Needs test coverage if you want it to be a serious alternative to Pusher. Nice
work.

------
iloveponies
Despite this and others like Socket.io, Pusher still appears to be popular and
doing well. How come?

~~~
SeanOC
Same reason most infrastructure as a service companies exist.

Setting up, maintaining, and scaling web socket messaging servers isn't my
core business. Accordingly I am happy to pay a reasonable fee to somebody like
Pusher to have the problem go away.

If real-time messaging is core/fundamental to your business, then you probably
should run your own servers. Otherwise let somebody else deal with that bit of
complexity and focus on the parts of your business that matter most.

------
ilaksh
Why do people use socket.io instead of Now.js?

~~~
wavephorm
Now.js uses socket.io and doesn't provide much additional functionality.

~~~
ilaksh
I know that now.js uses socket.io.

Now.js DOES make things simpler.

------
pasaba
Pretty friggin awesome man!

