Skip to content

Instantly share code, notes, and snippets.

@technovangelist
Created March 8, 2012 10:02
Show Gist options
  • Save technovangelist/2000074 to your computer and use it in GitHub Desktop.
Save technovangelist/2000074 to your computer and use it in GitHub Desktop.
Simple Pusher Server
http = require 'http'
url = require 'url'
pusher = require 'node-pusher'
mykey = 'Get Your Own Key at Pusher.com'
mysecret = 'Get Your Swn Secret'
myappid = 'Get Your Own App'
myPusher = new pusher(
appId: myappid
key: mykey
secret: mysecret)
channel = 'ChatChannel'
event = 'chat'
initdata=
from: 'The Server'
content: 'The Server is Online'
server = http.createServer (request, response) ->
query = url.parse(request.url,true).query
myPusher.trigger channel, event, {'from':query.from, 'content':query.content}
server.listen 8888
myPusher.trigger(channel,event,initdata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment