https://github.com/slok/redis-node-push-notifications-example
An example of using redis pub/sub for realtime client notifications with Redis, socket.io and node.js
https://github.com/slok/redis-node-push-notifications-example
Last synced: 6 months ago
JSON representation
An example of using redis pub/sub for realtime client notifications with Redis, socket.io and node.js
- Host: GitHub
- URL: https://github.com/slok/redis-node-push-notifications-example
- Owner: slok
- Created: 2013-04-05T15:18:22.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-04-06T10:25:04.000Z (over 12 years ago)
- Last Synced: 2025-03-19T08:39:19.627Z (7 months ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 24
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Realtime (Push) notifications based on Redis pub/sub, node.js and socket.io
===========================================================================The aim of this example is to provide a small guide for implementing
realtime notifications based on redis and socket.io (with node.js)Schema
------Client that pushes notifications -> Redis -> Node.js/Socket.io -> User browser
Requirements
------------- [Node](http://nodejs.org/)
- [Redis](http://redis.io)Running
-------In the project folder install [socket.io](http://socket.io/) and node [redis client](https://github.com/mranney/node_redis):
npm install socket.io redis
Start the redis database:
$ redis-server
Start the push notifications server:
$ node ./app.js
Start the client node server:
$ cd ./test-client
$ node ./client.jsOpen a browser and go to 127.0.0.1:8000, enter the id that you want and we are
ready to push some notifications.Open a redis client:
$ redis-cli
And with this key **push:notifications:[ID]** we publish messages into redis.
$ PUBLISH "push:notifications:slok" "Justin Bieber sucks"So all the published messages in the appropiate redis channels, will be
pushed to the user browser in realtime :)Now we should see the message **Justin Bieber sucks** in the message list
Author
------
[Xabier Larrakoetxea](http://xlarrakoetxea.org)License
-------
[GPL V3](http://www.gnu.org/licenses/gpl-3.0.html)