This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a simple example of WebSocket + Tornado + Redis Pub/Sub usage. | |
Do not forget to replace YOURSERVER by the correct value. | |
Keep in mind that you need the *very latest* version of your web browser. | |
You also need to add Jacob Kristhammar's websocket implementation to Tornado: | |
Grab it here: | |
http://gist.github.com/526746 | |
Or clone my fork of Tornado with websocket included: | |
http://github.com/pelletier/tornado | |
Oh and the Pub/Sub protocol is only available in Redis 2.0.0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
if (cluster.isWorker) { | |
console.log('Worker ' + process.pid + ' has started.'); | |
// Send message to master process. | |
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
// Receive messages from the master process. |