난 FAYE 레일 애플 리케이션을 사용하고 있습니다 그리고 그게 나를 귀찮게하는 유일한 일은 내가 캔트 만들거나 메시지를 수신 모델 변경.Faye 및 귀하의 레일 애플 리케이션에서 모델을 변경
마치 https://github.com/jamesotron/faye-rails 과 같아야하지만 다소 번거롭습니다.
확장 프로그램을 통해 모델을 업데이트 할 수있는 방법이 있습니까? 이 같은 아마 뭔가 :
require 'faye'
require './app/models/message.rb'
Faye::WebSocket.load_adapter('thin')
require File.expand_path('../config/initializers/faye_token.rb', __FILE__)
class MsgMonitor
def incoming(message, callback)
Message.create(:name=>message.to_s)
callback.call(message)
end
end
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
faye_server.add_extension(ServerAuth.new)
faye_server.add_extension(MsgMonitor.new)
run faye_server
하지만 오류가 있습니다. 그렇게 잘못하면 전체 레일 환경을로드해야합니다 (실제로 필요합니다).
어떤 도움이 높게 평가 될 것입니다 ....
PS 구글 그룹 기사 http://groups.google.com/group/faye-users/browse_thread/thread/620ee6440422687a?pli=1 를 사용하여 채널로 subsribe을 시도하지만 여전히 캔트 그것을 얻. 구독했지만 게시하지는 않습니다.
와우, 나는 그것을 조사해야한다! – prikha