Announcing presence support

We have been keeping fairly quiet over the last few weeks, beavering away at all the little details. However, amongst our invisible stability and scalability work, we have found a bit of time to add in a new feature that many of you have asked for. Pusher now supports Presence!

We are now looking for some intrepid souls to integrate presence into their applications and give us some feedback. This means that the public API may change in future versions, so adding this to production applications should be done at your own risk!

What is it?

In a nutshell, it allows you to securely identify users when they connect to a channel, retrieve a member list, and receive javascript events when another user joins and leaves a channel.

Why do I want it?

Because it allows you to give users a sense of who they are collaborating with. Maybe they’re working on a document together, but it could just be everyone who’s viewing a page.

Chat now becomes almost trivial to implement, but we think this is just the start.

How do I get started?

Look at the docs! If you are familiar with private channels, this should not be a huge change for you.

We broadcast member information in the same awesome event emitter format that you are already used to, so it should be a snap to get started. An example of the type of event you can bind to is:

presence_channel.bind("pusher:member_added", function(member){
  alert( member.user_info.username + " has just logged in!");
});

A very basic example of how presence can be linked to logged in users is available here.

Challenges

It has been quite an interesting feature to make, and we are confident that our callback-based system is the best way of guaranteeing authenticity. We work under the assumption that anything that comes directly from the client’s browser cannot be trusted. If I say I am ‘Max’, that has to be backed up with some credentials from a trusted application.

While looking at other implementations, we felt that though the way we do it is a little bit more involved, it is the only viable way of achieving this functionality where the authenticity of connected clients is essential.

Availability

This feature is available now, though you must use version 1.6 of our Javascript library.

We have added presence support to the latest version of our Ruby Gem (v0.6), and would encourage other library makers to make the necessary changes. There are some notes about implementing the signature here (it is basically an extension to private channels). Let us know if you need help.

“What happened to 1.4 and 1.5?” I hear you cry. These were released silently without much fanfare, but it is worth saying what they include at this point.

Pusher.js 1.4

Allows clients who have failed to connect because of proxy issues to reconnect using an SSL connection. This fixes the majority of cases where a client had failed to connect in the past. It doesn’t work with the Flash fallback yet, but we are working on that.

Pusher.js 1.5

Link to a version of the Flash fallback SWF on our servers. This allows us to better track which version people are using with the respective version of the javascript. It also means 1 less line of configuration.

Remember to let us know if you have any feedback, or need any help. And if you haven’t done so already, feel free to create a free Pusher account and let us know what you think!

Ready to begin?

Start building your realtime experience today.

From in-app chat to realtime graphs and location tracking, you can rely on Pusher to scale to million of users and trillions of messages