Skip to content

Instantly share code, notes, and snippets.

@josephg
Created October 10, 2011 00:37
Show Gist options
  • Save josephg/1274417 to your computer and use it in GitHub Desktop.
Save josephg/1274417 to your computer and use it in GitHub Desktop.
faye = require 'faye'
client = new faye.Client 'http://josephgentle.com:4321/bayeux'
client.subscribe '/msg', (message) ->
console.timeEnd message
.callback ->
console.log 'Connected!'
seq = 0
setInterval ->
message = seq++
client.publish '/msg', message
console.time message
, 1000
$ coffee c.coffee
Connected!
2: 531ms
1: 5626ms
4: 2626ms
3: 3627ms
5: 1626ms
6: 1694ms
8: 1726ms
7: 5927ms
13: 7917ms
11: 9917ms
19: 1918ms
15: 5917ms
12: 8918ms
17: 3919ms
16: 4919ms
14: 14792ms
25: 3793ms
24: 4793ms
27: 1793ms
26: 2792ms
23: 5792ms
20: 8792ms
21: 15966ms
22: 14965ms
18: 18965ms
29: 7966ms
30: 6966ms
faye = require 'faye'
bayeux = new faye.NodeAdapter
bayeux.listen 4321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment