2012-10-23 3 views
1

레일 응용 프로그램에서 faye 서버를 실행할 때이 오류가 발생합니다. 나는 eventmachine gem을 설치했고 또한 faye에 대한 초기화 파일에 이벤트 머신을 요구했다.faye 서버를 실행할 때 런타임 오류 이벤트 시스템

/Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/eventmachine-1.0.0/lib/eventmachine.rb:664:in `connect_server': eventmachine not initialized: evma_connect_to_server (RuntimeError) 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/eventmachine-1.0.0/lib/eventmachine.rb:664:in `bind_connect' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/eventmachine-1.0.0/lib/eventmachine.rb:640:in `connect' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-websocket-0.4.6/lib/faye/websocket/client.rb:19:in `initialize' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/transport/web_socket.rb:51:in `new' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/transport/web_socket.rb:51:in `connect' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/transport/web_socket.rb:26:in `usable?' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/transport/web_socket.rb:11:in `usable?' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/transport/transport.rb:82:in `block in get' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:103:in `call' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:103:in `block in async_each' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:110:in `call' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:110:in `block in async_each' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:117:in `call' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:117:in `block in async_each' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:119:in `call' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye.rb:119:in `async_each' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/transport/transport.rb:97:in `get' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/protocol/client.rb:311:in `select_transport' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/faye-0.8.6/lib/faye/protocol/client.rb:35:in `initialize' 
from /Users/vivekvivek/website/faye.ru:38:in `new' 
from /Users/vivekvivek/website/faye.ru:38:in `block in <main>' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize' 
from /Users/vivekvivek/website/faye.ru:1:in `new' 
from /Users/vivekvivek/website/faye.ru:1:in `<main>' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:200:in `app' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:252:in `start' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:137:in `start' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/bin/rackup:19:in `load' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/bin/rackup:19:in `<main>' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval' 
from /Users/vivekvivek/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>' 

이 오류가 갑자기 나타납니다. 도움을 주셔서 감사합니다.

+0

레일을 EM 지원 서버 (thin, puma, passenger ...)에서 실행하고 있습니까? –

답변

1
require 'faye' 
require 'eventmachine' 

EM.run do 
    client = Faye::Client.new('http://localhost:9292/faye') 
    publication = client.publish("/faye/new_chats", { 
     "user" => "ruby-logger", 
     "message" => "Got your message!" 
    }) 
    publication.callback do 
    puts "[PUBLISH SUCCEEDED]" 
    end 
    publication.errback do |error| 
    puts "[PUBLISH FAILED] #{error.inspect}" 
    end 
end