Last active
December 29, 2015 10:48
-
-
Save huydx/7659113 to your computer and use it in GitHub Desktop.
faye_hook.rb
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
require 'rubygems' | |
require 'faye' | |
class ServerAuth | |
def incoming(message, callback) | |
do_something if message =~ /^\/meta\/subscribe/ | |
do_other_something if message =~ /^\/meta\/unsubscribe/ | |
callback.call(message) | |
end | |
private | |
def do_somethig;end | |
def do_other_somethig;end | |
end | |
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45) | |
faye_server.add_extension(ServerAuth.new()) | |
run faye_server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment