在faye.ru我有這樣的代碼跟faye_token:王菲服務器錯誤 - 未定義的方法 - 進入
require 'faye'
require File.expand_path('../config/initializers/faye_token.rb', __FILE__)
Faye::WebSocket.load_adapter('thin')
class ServerAuth
def incoming(message, callback)
if message['channel'] !~ %r{^/meta/}
if 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.add_extension(ServerAuth.new)
run faye_server
如果我運行這段代碼在終端:
rackup faye_alt.ru -E production -s thin
如果我刷新本地主機web-seite - 我成爲這個錯誤:
[ERROR] [Faye::RackAdapter] undefined method `[]' for nil:NilClass
任何想法?請幫忙!