Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Thunderpush is a Tornado and SockJS based push service. It provides a Beaconpush ( inspired HTTP API and client.


pip install thunderpush

Using Docker

docker run -d -p 8080:8080 \
    -e PUBLIC_KEY=public \
    -e PRIVATE_KEY=secret \


usage: thunderpush [-h] [-p PORT] [-H HOST] [-v] [-d] [-V] clientkey apikey

positional arguments:
  clientkey             client key
  apikey                server API key

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  binds server to custom port
  -H HOST, --host HOST  binds server to custom address
  -v, --verbose         verbose mode
  -d, --debug           debug mode (useful for development)
  -V, --version         show program's version number and exit

JavaScript client

In order to use provided by Thunderpush client, you need to include following lines on your webpage.

<script src=""></script>
<script src="thunderpush.js"></script>

The only thing you have to do now is to make a connection to your Thunderpush server in following way:

<script type="text/javascript">
Thunder.connect("", "apikey", ["testchannel"], {log: true});
Thunder.listen(function(message) { alert(message); });

This code is all you need to do to start receive messages pushed to the client from your Thunderpush server. As you can see, we instructed Thunder client to display logs, which can be helpful for debugging your application.

For more examples of how to use Thunderpush, look into examples.

Open-source libraries for communicating with the HTTP API

Python: python-thunderclient

PHP: php-thunderclient

Java: java-thunderclient

Hubot: hubot-thunderpush

Ruby: thunderpush-gem

.NET: ThunderClient.Net

Using the HTTP API

Example of interacting with Thunderpush API using cURL:

curl \
        -X POST \
        -H "Content-Type: application/json" \
        -H "X-Thunder-Secret-Key: secretkey" \
        --data-ascii "\"Hello World!\"" \[API key]/channels/[channel]/

All requests to the HTTP API must provide X-Thunder-Secret-Key header that should contain the private API key.

Sending a message to a channel

POST /api/1.0.0/[API key]/channels/[channel]/

Message should be sent as the body of the request. Only valid JSON body will be accepted.

Getting number of users online

GET /api/1.0.0/[API key]/users/

Checking presence of a user

GET /api/1.0.0/[API key]/users/[user id]/

Sending a message to a user

POST /api/1.0.0/[API key]/users/[user id]/

Message should be sent as the body of the request. Only valid JSON body will be accepted.

Forcing logout of a user

DELETE /api/1.0.0/[API key]/users/[user id]/

Always returns 204 http code.

Retrieving list of users in a channel

GET /api/1.0.0/[API key]/channels/[channel]/

JavaScript client API

Connecting to the server

Thunder.connect(server, apiKey, channels, options)

Connects to the Thunderpush server and starts listening for incomming messages.

Adress of your Thunderpush server.
Public api key.
Array of channels you want to subscribe to.

Object with optional settings you may pass to Thunder:

Set it to true if you want to activate verbose mode. This will turn on SockJS logs as well.

Set it to override the client generated user id.

protocol Set it to "https" if you want to use it instead of "http".

Listening for messages


Registers callback function that will receive incomming messages. You can register as many handlers you want. Handler function should accept one argument which is the message itself.

Getting high CPU usage?

Before giving up on thunderpush, check it's logs and look for errors like this one error: [Errno 24] Too many open files. If you're seeing them, it means that you've reached the limit of open file descriptors on your system. The only thing you need to do is to raise the limit. Following SO answer will tell you how to do it: Then simply restart thunderpush, forget about the problem and get a cold one!