Created
March 8, 2012 10:02
-
-
Save technovangelist/2000074 to your computer and use it in GitHub Desktop.
Simple Pusher Server
This file contains hidden or 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
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