├── README.md └── node.js ├── package.json ├── README.md ├── client.html └── server.js /README.md: -------------------------------------------------------------------------------- 1 | Realtime stats implementation using Node.js/Golang, Redis and Socket.IO 2 | 3 | - node.js : Node.js implementation 4 | - golang : Go implementation 5 | -------------------------------------------------------------------------------- /node.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "node.js", 3 | "description" : "Realtime stats using node.js, socket.io and redis", 4 | "version" : "0.0.1", 5 | "author": { 6 | "name": "Venu Anuganti", 7 | "email": "venu@venublog.com" 8 | }, 9 | "dependencies" : { 10 | "redis": "", 11 | "socket.io": "", 12 | "express": "" 13 | }, 14 | "repository" : { 15 | "type": "git", 16 | "url": "http://github.com/vanuganti/realtime" 17 | }, 18 | "engines" : { 19 | "node": ">=0.4.0" 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /node.js/README.md: -------------------------------------------------------------------------------- 1 | Realtime stats - Node.js, Socket.IO & Redis 2 | =========================================== 3 | 4 | For complete walk-through, check my blog post on this: http://venublog.com/2013/06/26/realtime-web-stats-using-node-js-socket-io-and-redis/ 5 | 6 | Requirements: 7 | ------------- 8 | - Node.js server (http://nodejs.org/) 9 | - Node.js modules 10 | - express (http://expressjs.com/) 11 | - redis (https://github.com/simplegeo/nodejs-redis) 12 | - socket.io (http://socket.io/#how-to-use) 13 | 14 | - Redis server (http://redis.io/) 15 | 16 | Get Started: 17 | ------------ 18 | 19 | - Clone the git repo and install dependency packages 20 | 21 | 22 | ```shell 23 | $ git clone git@github.com:vanuganti/realtime.git 24 | $ cd realtime 25 | $ cd node.js 26 | $ npm install 27 | ``` 28 | 29 | - Start the redis server (default localhost on port 6379) 30 | - Start node with server.js 31 | 32 | ```shell 33 | $ node server.js 34 | ``` 35 | 36 | - Open client.html in browser code 37 | 38 | ```shell 39 | $ open client.html 40 | ``` 41 | 42 | - Publish a counter to 'realtime' channel in redis 43 | 44 | ```shell 45 | $ redis-cli publish realtime 99 46 | ``` 47 | 48 | - Notice the updated counter in browser 49 | 50 | For additional details, check http://venublog.com/2013/06/26/realtime-web-stats-using-node-js-socket-io-and-redis/ 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /node.js/client.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 ||
45 | 0 46 | |
47 |