eventmachine

How do you spawn an EventMachine “inside” a Rails app?

痴心易碎 提交于 2019-11-27 11:15:12
问题 I've got a Rails application, and am looking to add some sort of WebSocket support to it. From various googling, it appears that the best Ruby based WebSocket solution is em-websocket running on EventMachine. I was wondering if there was a way to "integrate" an EventMachine reactor into Rails? Where do I put the initialization code? Is this the proper way to accomplish this? I've seen this example that falls back on Sinatra to do an EventMachine GET request, but that isn't quite what I'm

gem eventmachine fatal error: 'openssl/ssl.h' file not found

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 09:59:14
Just installed El Capitan and can't install gem eventmachine 1.0.7 . openssl is at 1.0.2a-1 . Tried to use --with-ssl-dir but it seems ignored. Reported it to their github repo as well. Any suggestions are really appreciated. Thanks. $ ls /usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h /usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h $ gem install eventmachine -v '1.0.7' -- --with-ssl-dir=/usr/local/Cellar/openssl/1.0.2a-1/include /Users/pain/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150612-56154-1hsjz2n.rb extconf.rb --with-ssl-dir=/usr/local/Cellar/openssl/1.0.2a-1

Eventmachine gem install fail

对着背影说爱祢 提交于 2019-11-27 07:36:01
I am not able to install eventmachine Ok I know this has been asked quite a lot, but no solutions I found has helped me so far.So I posted here as a last resort. I use windows 8 x64 using ruby 2.0.0p195 (x64) (installed throught Ruby Installer for Windows with the apropriate Devkit) So the Error is Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension C:/Ruby200-x64/bin/ruby.exe extconf.rb checking for main() in -lssl... no checking for rb_trap_immediate in ruby.h,rubysig.h... no checking for rb_thread_blocking_region()... yes checking for inotify_init() in sys

Any success with Sinatra working together with EventMachine WebSockets?

大城市里の小女人 提交于 2019-11-27 05:01:05
问题 I have been using Sinatra for sometime now and I would like to add some realtime features to my web-app by pushing the data via websockets. I have successfully used the gem 'em-websocket' on its own, but have not been able to write one ruby file that has a sinatra web server AND a web-socket server. I've tried spinning the run! or start! methods off in separate threads with no success. Has anyone gotten this to work? I want to have them in the same file as I can then share variables between

What is the difference between event driven model and reactor pattern? [closed]

亡梦爱人 提交于 2019-11-27 04:55:26
问题 From the wikipedia Reactor Pattern article: The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs. It named a few examples, e.g. nodejs , twisted , eventmachine But what I understand that above is popular event driven framework, so make them also a reactor pattern framework? How to differentiate between these two? Or they are the same? 回答1: The reactor pattern is more specific than "event driven

How can I push to Faye Server from Rails Controller?

痴心易碎 提交于 2019-11-27 03:49:33
问题 I have this code: def create message = Message.new(text: params[:message][:text], author: params[:message][:author]) if message.save render json: {result: 'success'} else render json: {result: 'failure'} end end I have client subscribed to Faye Server: var subscription = client.subscribe('/foo', function (message) { getMessages(); }); I want to publish some message to Faye when a message is created. As listed in Faye Ruby Sever documentation, I have to do like this: require 'eventmachine' EM

Peer-to-peer file sharing with Web Sockets

痞子三分冷 提交于 2019-11-26 22:01:45
问题 This is sort of a theoretical question, however, I need to add file sharing capabilities to my web socket powered chat application. I could use a service like Amazon S3 to upload a file to share by posting a link to the file, but that involves the uploading of a file that may already be accessible over the local network (sharing a file between co-workers for example). So I had the idea that it might be possible to somehow tunnel the upload/download/transfer through the already existing web

Rails - cannot run app: Unable to load the EventMachine C extension;

痞子三分冷 提交于 2019-11-26 21:54:54
问题 When I run an app on Lion OS X, I get this error: Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby' /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in `require': no such file to load -- rubyeventmachine (LoadError) from /Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in `<top (required)>' from /Users/adam/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler

Eventmachine gem install fail

泄露秘密 提交于 2019-11-26 13:37:45
问题 I am not able to install eventmachine Ok I know this has been asked quite a lot, but no solutions I found has helped me so far.So I posted here as a last resort. I use windows 8 x64 using ruby 2.0.0p195 (x64) (installed throught Ruby Installer for Windows with the apropriate Devkit) So the Error is Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension C:/Ruby200-x64/bin/ruby.exe extconf.rb checking for main() in -lssl... no checking for rb_trap_immediate in ruby.h