A new user-centric model for Pusher Channels. Send realtime server messages to individuals and terminate connections for malicious users.
At the core of the Pusher Channels model is a very simple proposition: we help get data to users who need it, fast.
While there are endless Pusher use cases which are modelled on large scale broadcast updates to huge numbers of users (think of dashboard updates, live sports scores or news events on an activity feed) many realtime applications also require the ability to address certain updates to individual users. Only a specified user needs to know where their food delivery is, or who has liked their social media post.
We have found recurring patterns in the applications of developers building with Pusher. Many of these use cases revolve around the user model of an application.
Today we’re releasing the first part of a new model that is more sympathetic to a user-based approach.
If you’re building an application with Pusher today, it’s likely that you have some user-specific functionality built into your app. Whether that’s user access management through functions like authenticated channels, messaging between your server and your user, presence indication or notifications.
You can do this already with Pusher’s pub/sub model of course, usually by creating a channel that only a single user is expected to join. This works well, and has been a popular solution. However, we want to provide more efficient mechanisms for building user-centric applications.
Today we’re releasing the first part of a new model that is more sympathetic to a user-based approach. The model identifies users as a distinct concept in the Pusher system and will help you automate more of your development when it comes to identifying connected users and expanding on the connection-user relationship.
There are 3 main parts to this initial launch:
To take advantage of our new user functionality you’ll need to:
signin()
method after instantiating your Pusher instance in your client code to authenticate users.pusher.user.bind()
to bind a callback to receive messages sent to the user.sendToUser()
method on the server SDK to send messages to a user.pusher.terminateUserConnections()
on the server SDK to terminate all active connections of a user (note that it is up to you to make sure you prevent them from establishing new connections via your authentication endpoint).Your application has full control over the user data stored in Pusher User. The user data can be retrieved, updated, or deleted using the Server SDK.
These new mechanisms are currently available as a limited release for pusher-js users. Support for other clients will be coming soon. Keep an eye out for more features which make use of the new concept by following us on Twitter. We plan to incorporate it into a new presence model soon.
Are there any user-oriented features you need for your Pusher apps? Reach out to our team to feedback on the users concept or check out our docs to get started.
Pusher is a hosted API toolkit with everything you need to build dynamic and engaging realtime apps. Sign up to try it out for free today.