Skip to content

Instantly share code, notes, and snippets.

@andrewarrow
Created April 11, 2013 21:16
Show Gist options
  • Save andrewarrow/5367249 to your computer and use it in GitHub Desktop.
Save andrewarrow/5367249 to your computer and use it in GitHub Desktop.
Faye = require 'faye'
run_it = () ->
fc = new Faye.Client 'http://localhost:8000/channel'
sub = fc.subscribe '/foo', (payload) ->
fc.disconnect()
sub.callback () ->
fc.publish '/foo', {hi: 'hello'}
setInterval run_it, 2000
Faye = require 'faye'
fayeRedis = require 'faye-redis'
web = require 'http'
bayeux = new Faye.NodeAdapter {
mount: '/channel'
timeout: 45
engine: {
type: fayeRedis
host: 'localhost'
port: 6379
database: 1
}
}
server = web.createServer (request, response) ->
bayeux.attach server
server.listen 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment