Play! 2 Module for the Pusher service.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This module has not been updated in a while, and is now using an outdated version of Pusher.

If you’re interested in this library, we encourage you to try it out with the newest version of Pusher, and to contribute any changes that would be necessary for proper integration.

Pusher module for Play! 2

This module lets you easily interact with the Pusher Service within your Play 2 application.


To use this module on your Play 2 application, you need to modify your Build.scala file:

val appDependencies = Seq(
  (... your other dependencies, if any ...)
  "tindr" % "play2pusher_2.9.1" % "1.0.1" // Tindr's play2pusher module dependency

val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings( 
  (... your other settings, if any ...)
  resolvers += Resolver.url("Tindr's Play module repository", 

That’s it!

Next time you build your project, it will fetch the module from our repository and add it to your project’s dependencies.


Take a look at the Play2Pusher-sample project for a short example on how to use the module.

The preferred usage is as follows:

// Trigger an event on a channel and deliver a message to all the connected sockets:
val pusher = Pusher()
val promise = pusher.trigger(channel, event, message)

Which requires adding the following lines to your application.conf file:

# Pusher Configuration
pusher.appId = APP_ID
pusher.key = KEY
pusher.secret = SECRET

You could also do the following instead of using the application.conf file:

val pusher = Pusher(APP_ID, KEY, SECRET)
val promise = pusher.trigger(channel, event, message)

Examining the response

The Pusher.trigger method returns a Promise[Response], which you can manipulate to verify the response status and body for error handling.

Successful events will respond with a 202 status. For more details, take a look at

Excluding sockets

You can also exclude a socket (usually the sender) from receiving the message by specifying its socket id:

pusher.trigger(channel, event, message, socketId)

Generating the authentication string

When a socket tries to connect to a private channel, it will make a POST request to /pusher/auth on your server. You will need to generate and return a JSON object containing the auth signature that allows the socket to connect to the private channel. This is achieved by:

pusher.createAuthString(socketId, channelName)


In your controller you can have something like this:

val socketId = "yourSocketId"
val channelName = "yourChannelName"
renderJSON(pusher.createAuthString(socketId, channelName))

Disabling Pusher events

You might need to turn off Pusher notifications altogether for testing or debugging.

The pusher.enabled=false configuration option allows you to do just this. It defaults to true if not found.

Pending work

  1. Support Presence channels properly.
  2. Add samples for private and presence channels.