Sha256: f01d61dcf9fde0f3e9b2a1460c425f3fc89de46d822a22c0eadd457caa3a0311

Contents?: true

Size: 676 Bytes

Versions: 5

Compression:

Stored size: 676 Bytes

Contents

// This script demonstrates a logger for the chat app. First, start
// the chat server in one terminal then run this in another:
// 
//   $ node examples/node/app.js
//   $ node examples/node/client.js
// 
// The client connects to the chat server and logs all messages
// sent by all connected users.

var sys  = require('sys'),
    faye = require('./faye');

var client = new faye.Client('http://localhost:8000/comet');

client.subscribe('/from/*', function(message) {
  var user = message.user;
  sys.puts('[' + user + ']: ' + message.message);
  client.publish('/mentioning/' + user, {
    user:   'node-logger',
    message:  'Got your message, ' + user + '!'
  });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
faye-0.3.4 examples/node/client.js
faye-0.3.3 examples/node/client.js
faye-0.3.2 examples/node/client.js
faye-0.3.1 examples/node/client.js
faye-0.3.0 examples/node/client.js