All Projects → thunderpush → Thunderpush

thunderpush / Thunderpush

Licence: other
Push messages to browsers in real-time ⚡️

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Thunderpush

Sockjs Client
WebSocket emulation - Javascript client
Stars: ✭ 7,808 (+3765.35%)
Mutual labels:  websocket, real-time
Autobahn Js
WAMP in JavaScript for Browsers and NodeJS
Stars: ✭ 1,345 (+565.84%)
Mutual labels:  websocket, real-time
Rtb
Benchmarking tool to stress real-time protocols
Stars: ✭ 35 (-82.67%)
Mutual labels:  websocket, real-time
Primus
⚡ Primus, the creator god of the transformers & an abstraction layer for real-time to prevent module lock-in.
Stars: ✭ 4,302 (+2029.7%)
Mutual labels:  websocket, real-time
Tardis Node
Convenient access to tick-level real-time and historical cryptocurrency market data via Node.js
Stars: ✭ 126 (-37.62%)
Mutual labels:  websocket, real-time
Centrifugo
Scalable real-time messaging server in a language-agnostic way. Set up once and forever.
Stars: ✭ 5,649 (+2696.53%)
Mutual labels:  websocket, real-time
Sec Api
sec.gov EDGAR API | search & filter SEC filings | over 150 form types supported | 10-Q, 10-K, 8, 4, 13, S-11, ... | insider trading
Stars: ✭ 71 (-64.85%)
Mutual labels:  websocket, real-time
Ws
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js
Stars: ✭ 17,419 (+8523.27%)
Mutual labels:  websocket, real-time
Iot Technical Guide
🐝 IoT Technical Guide --- 从零搭建高性能物联网平台及物联网解决方案和Thingsboard源码分析 ✨ ✨ ✨ (IoT Platform, SaaS, MQTT, CoAP, HTTP, Modbus, OPC, WebSocket, 物模型,Protobuf, PostgreSQL, MongoDB, Spring Security, OAuth2, RuleEngine, Kafka, Docker)
Stars: ✭ 2,334 (+1055.45%)
Mutual labels:  websocket, real-time
Autobahn Java
WebSocket & WAMP in Java for Android and Java 8
Stars: ✭ 1,467 (+626.24%)
Mutual labels:  websocket, real-time
Engine.io
socket.io
Stars: ✭ 4,329 (+2043.07%)
Mutual labels:  websocket, real-time
Sockjs Node
WebSocket emulation - Node.js server
Stars: ✭ 1,987 (+883.66%)
Mutual labels:  websocket, real-time
Centrifuge
Real-time messaging library for Go with scalability in mind
Stars: ✭ 446 (+120.79%)
Mutual labels:  websocket, real-time
Engine.io Client
Stars: ✭ 649 (+221.29%)
Mutual labels:  websocket, real-time
Wampsharp
A C# implementation of WAMP (The Web Application Messaging Protocol)
Stars: ✭ 355 (+75.74%)
Mutual labels:  websocket, real-time
Gophergameserver
🏆 Feature packed, easy-to-use game server API for Go back-ends and Javascript clients. Tutorials and examples included!
Stars: ✭ 61 (-69.8%)
Mutual labels:  websocket, real-time
Sandstone
PHP microframework designed to build a RestApi working together with a websocket server. Build a real time RestApi!
Stars: ✭ 98 (-51.49%)
Mutual labels:  websocket, real-time
Actioncable Vue
A Vue plugin that makes integrating Rails Action Cable dead-easy.
Stars: ✭ 138 (-31.68%)
Mutual labels:  websocket, real-time
Autobahn Python
WebSocket and WAMP in Python for Twisted and asyncio
Stars: ✭ 2,305 (+1041.09%)
Mutual labels:  websocket, real-time
Him Netty
开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~
Stars: ✭ 194 (-3.96%)
Mutual labels:  websocket

.. image:: http://i.imgur.com/CgGL5eU.png

.. image:: https://img.shields.io/pypi/v/thunderpush.svg :target: https://pypi.python.org/pypi/thunderpush

.. image:: https://img.shields.io/travis/thunderpush/thunderpush/master.svg :target: http://travis-ci.org/thunderpush/thunderpush

.. image:: https://img.shields.io/docker/pulls/kjagiello/thunderpush.svg :target: https://hub.docker.com/r/kjagiello/thunderpush/

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

Install

::

pip install thunderpush

Using Docker

::

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

Usage

::

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.

.. code-block:: html

<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></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:

.. code-block:: html

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

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 <https://github.com/thunderpush/thunderpush/tree/master/examples>_.

Open-source libraries for communicating with the HTTP API

Python: python-thunderclient <https://github.com/thunderpush/python-thunderclient>_

PHP: php-thunderclient <https://github.com/thunderpush/php-thunderclient>_

Java: java-thunderclient <https://github.com/Sim00n/java-thunderclient>_

Hubot: hubot-thunderpush <https://github.com/thunderpush/hubot-thunderpush>_

Ruby: thunderpush-gem <https://github.com/welingtonsampaio/thunderpush-gem>_

.NET: ThunderClient.Net <https://github.com/primediabroadcasting/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!\"" \
	http://thunder.example.com/api/1.0.0/[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 ^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: javascript

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

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

server Adress of your Thunderpush server.

apiKey Public api key.

channels Array of channels you want to subscribe to.

options Object with optional settings you may pass to Thunder:

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

user 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 ^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: javascript

Thunder.listen(handler)

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: http://stackoverflow.com/a/4578356/250162 Then simply restart thunderpush, forget about the problem and get a cold one!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].