Pusher.com for real-time client updates

Pusher.com is a service that applications can use to send real-time updates to web clients to have things update automatically. And it’s awesome. Here’s why:

  1. It’s easy to implement on the server side
  2. It’s easy to implement on the client side
  3. It scales your application for you

What would you use it for? Creating instantly updating chat clients. Showing activity on a map as it happens. Showing when people sign in or out of a service. Interactive games. Live dashboards.

You can just play around for as long as you need with the free sandbox plan.

Implement it on the server side (Ruby on Rails):

gem 'pusher' # add to Gemfile
Pusher['test_channel'].trigger('my_event', 'my data string')

Implement it on the client side:

<script src="http://js.pusherapp.com/1.8/pusher.min.js" type="text/javascript"></script>
<script type="text/javascript">
  var key = ''; // Found in your Pusher sandbox account
  var pusher = new Pusher(key);
  var channel = pusher.subscribe('test_channel');
  channel.bind('my_event', function(data) {
    alert(data);
   });
</script>

Invoking the Pusher code from the server side will now show a Javascript alert on all clients that have a page open with the above Javascript on it.

Pusher’s technology is based on HTML5 WebSockets. There are obviously other WebSockets based libraries and services but there is a distinct advantage to Pusher’s implementation. First of all, Pusher implements a fall-back using Flash. The combination of these two technologies means it will work on pretty much any browser. Pusher also has a great debugging tool which lets you see who is listening and what data is sent on the channel.

Whether you have 5 users listening on the channel or 5,000 it does not matter. You only write to the channel once and any client listing will receive the event. All you need to do is pay Pusher some more money as your application gains more users, but hopefully it means lots of users are using your application.

So as you can see, Pusher is pretty awesome, because it will make your application more awesome! I’m excited say that today’s BugHerd release makes use of it to push task updates to other users in the project.

SugarCRM’s future?

Having done some recent work on SugarCRM, I couldn’t help but draw a comparison with other systems I work with: Magento and Salesforce. Because that’s what I think SugarCRM should be: Salesforce functionality with a Magento architecture. SugarCRM’s popularity is obviously mostly because it is open source and free to use however it does not use a high level web development framework such as PHP Zend like Magento does, which is also open-source.

There is a good reason why Salesforce is so actively pursuing developers to build on their Force.com platform. They want to build an ecosystem that users can’t and don’t want to leave. It’s a model that Apple has proven to be extremely valuable and for good reason. Anyone can compete with a product, but an ecosystem is extremely hard to copy. Even though Salesforce comes at a premium, the AppExchange is a good reason to use Salesforce. If you want to store your customers in a database, you can use any old address book or CRM but if you need specific analytics, workflow, integrations, online portals, etc then Salesforce is one of the easiest to extend. I’ll mention NetSuite here as well but it’s no secret I’m not a big fan, because even though they do provide a powerful development framework, they don’t foster a developer community like Salesforce does.

So why the comparison of SugarCRM and Magento? Magento is an e-commerce platform, not a CRM. But it’s the architecture of Magento that sets it apart from its competitors (like osCommerce). SugarCRM and Magento both use PHP. Magento however uses the PHP Zend framework. SugarCRM is not based on any framework, it uses ‘straight’ PHP. Sugar does use an MVC-like model and does provide documentation for it, but it is custom built so it takes longer to get familiar with than if they used a standard framework.

I’m a big fan of MVC frameworks such as PHP Zend and Ruby on Rails. Those frameworks make coding more high level. Less detail to worry about means more of your time gets spent building an application. All the common website issues like SQL injections, cross site request forgery, are generally taken care of. But also simpler things like providing helpers for building HTML views. Since SugarCRM’s inception, many awesome frameworks have been introduced. In the battle to win the hearts and minds of developers, picking one of these to build on would help greatly.

Magento has overtaken osCommerce in backend architecture. Right now, I think SugarCRM is in osCommerce’s position before Magento existed. I would love to see SugarCRM adopt a framework such as Zend. It would be a setback in terms of the existing modules but in the long term will likely see more and better modules being written. Already we are seeing the emergence of other open source CRM systems such as Fat Free CRM (written in Ruby on Rails).

SugarCRM has a great advantage over Salesforce in that it’s open source and therefore a much larger potential reach of small businesses. But applications are now more often judged on their ability to integrate and develop for. And SugarCRM is falling behind. Here’s hoping that will change.