first evented steps

This commit is contained in:
2012-11-27 15:31:31 +01:00
parent e65dc584a4
commit 3da9dc68d7
9 changed files with 53 additions and 24 deletions
+18
View File
@@ -0,0 +1,18 @@
require 'faye'
#require File.expand_path('../config/initializers/faye_token.rb', __FILE__)
class ServerAuth
def incoming(message, callback)
if message['channel'] !~ %r{^/meta/}
if false && message['ext']['auth_token'] != FAYE_TOKEN
message['error'] = 'Invalid authentication token'
end
end
callback.call(message)
end
end
faye_server = Faye::RackAdapter.new(mount: '/faye', timeout: 45)
faye_server.listen 9292
faye_server.add_extension(ServerAuth.new)
run faye_server