Closed xanguera closed 7 years ago
Hey Xavier,
I'd recommend using ActionCable if you're on rails 5. Tubesock was more for Rails 4 before we had ActionCable.
Nick
On Aug 9, 2017 4:51 PM, "Xavier Anguera" notifications@github.com wrote:
Hi, I am trying to use the gem in Rails 5+ inside a controller. I have so far just added the example code and tried to connect, but I am getting the error below. I am a beginner in ruby/rails and don't know what to do (sorry if it is a generic/trivial question).
NameError - undefined local variable or method
env' for #<SpeechApiController:0x007fb45a56be70>: tubesock (0.2.7) lib/tubesock/hijack.rb:30:in
hijack' app/controllers/speech_api_controller.rb:14:inwebsocket' actionpack (5.1.2) lib/action_controller/metal/basic_implicit_render.rb:4:in
send_action' actionpack (5.1.2) lib/abstract_controller/base.rb:186:inprocess_action' actionpack (5.1.2) lib/action_controller/metal/rendering.rb:30:in
process_action' actionpack (5.1.2) lib/abstract_controller/callbacks.rb:20:inblock in process_action' activesupport (5.1.2) lib/active_support/callbacks.rb:131:in
run_callbacks' actionpack (5.1.2) lib/abstract_controller/callbacks.rb:19:inprocess_action' actionpack (5.1.2) lib/action_controller/metal/rescue.rb:20:in
process_action' actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:32:inblock in process_action' activesupport (5.1.2) lib/active_support/notifications.rb:166:in
block in instrument' activesupport (5.1.2) lib/active_support/notifications/instrumenter.rb:21:ininstrument' activesupport (5.1.2) lib/active_support/notifications.rb:166:in
instrument' actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:30:inprocess_action' actionpack (5.1.2) lib/action_controller/metal/params_wrapper.rb:252:in
process_action' activerecord (5.1.2) lib/active_record/railties/controller_runtime.rb:22:inprocess_action' actionpack (5.1.2) lib/abstract_controller/base.rb:124:in
process' actionview (5.1.2) lib/action_view/rendering.rb:30:inprocess' actionpack (5.1.2) lib/action_controller/metal.rb:189:in
dispatch' actionpack (5.1.2) lib/action_controller/metal.rb:253:indispatch' actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:49:in
dispatch' actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:31:inserve' actionpack (5.1.2) lib/action_dispatch/journey/router.rb:46:in
block in serve' actionpack (5.1.2) lib/action_dispatch/journey/router.rb:33:inserve' actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:832:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' rack-pjax (1.0.0) lib/rack/pjax.rb:12:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' newrelic_rpm (4.3.0.335) lib/new_relic/rack/agent_hooks.rb:30:in
traced_call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' newrelic_rpm (4.3.0.335) lib/new_relic/rack/browser_monitoring.rb:32:in
traced_call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' app/middleware/exercise_backend.rb:575:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' remotipart (1.3.1) lib/remotipart/middleware.rb:32:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' warden (1.2.7) lib/warden/manager.rb:36:in
block in call' warden (1.2.7) lib/warden/manager.rb:35:incall' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in
call' rack (2.0.3) lib/rack/etag.rb:25:incall' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in
call' rack (2.0.3) lib/rack/conditional_get.rb:25:incall' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in
call' rack (2.0.3) lib/rack/head.rb:12:incall' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in
call' rack (2.0.3) lib/rack/session/abstract/id.rb:232:incontext' rack (2.0.3) lib/rack/session/abstract/id.rb:226:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/cookies.rb:613:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' activerecord (5.1.2) lib/active_record/migration.rb:556:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/callbacks.rb:26:in
block in call' activesupport (5.1.2) lib/active_support/callbacks.rb:97:inrun_callbacks' actionpack (5.1.2) lib/action_dispatch/middleware/callbacks.rb:24:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/executor.rb:12:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' better_errors (2.3.0) lib/better_errors/middleware.rb:84:in
protected_app_call' better_errors (2.3.0) lib/better_errors/middleware.rb:79:inbetter_errors_call' better_errors (2.3.0) lib/better_errors/middleware.rb:57:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/debug_exceptions.rb:59:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' web-console (2.3.0) lib/web_console/middleware.rb:28:in
block in call' web-console (2.3.0) lib/web_console/middleware.rb:18:incall' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in
call' actionpack (5.1.2) lib/action_dispatch/middleware/show_exceptions.rb:31:incall' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:in
call' lograge (0.6.0) lib/lograge/rails_ext/rack/logger.rb:15:incall_app' railties (5.1.2) lib/rails/rack/logger.rb:24:in
block in call' activesupport (5.1.2) lib/active_support/tagged_logging.rb:69:inblock in tagged' activesupport (5.1.2) lib/active_support/tagged_logging.rb:26:in
tagged' activesupport (5.1.2) lib/active_support/tagged_logging.rb:69:intagged' railties (5.1.2) lib/rails/rack/logger.rb:24:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/remote_ip.rb:79:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' request_store (1.3.2) lib/request_store/middleware.rb:9:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/request_id.rb:25:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' rack (2.0.3) lib/rack/method_override.rb:22:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' rack (2.0.3) lib/rack/runtime.rb:22:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' activesupport (5.1.2) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/executor.rb:12:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' actionpack (5.1.2) lib/action_dispatch/middleware/static.rb:125:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' rack (2.0.3) lib/rack/sendfile.rb:111:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' railties (5.1.2) lib/rails/engine.rb:522:in
call' newrelic_rpm (4.3.0.335) lib/new_relic/agent/instrumentation/middleware_tracing.rb:92:incall' puma (3.9.1) lib/puma/configuration.rb:224:in
call' puma (3.9.1) lib/puma/server.rb:602:inhandle_request' puma (3.9.1) lib/puma/server.rb:435:in
process_client' puma (3.9.1) lib/puma/server.rb:299:inblock in run' puma (3.9.1) lib/puma/thread_pool.rb:120:in
block in spawn_thread'— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ngauthier/tubesock/issues/53, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA1Vg7SZfnFJl_e4cwe1YzGQWEAv9afks5sWhvOgaJpZM4Oyn58 .
Hi nick, Thanks a lot for the recommendation. I had not looked into ActionCable as all posts I find are pre 2015. I will do right away. I am basically looking for a way to make my server serve both http and websocket requests. I have been experimenting with Faye-websocket, but I can only get a single thread per Puma process to serve requests. This is why I was not trying Tubesock. With your experience, would ActionCable solve my problem? any reference link you could propose?
Thanks!
Yes, I think it should work great for you. Here's the rails guide:
http://guides.rubyonrails.org/action_cable_overview.html
On Aug 9, 2017 5:19 PM, "Xavier Anguera" notifications@github.com wrote:
Hi nick, Thanks a lot for the recommendation. I had not looked into ActionCable as all posts I find are pre 2015. I will do right away. I am basically looking for a way to make my server serve both http and websocket requests. I have been experimenting with Faye-websocket, but I can only get a single thread per Puma process to serve requests. This is why I was not trying Tubesock. With your experience, would ActionCable solve my problem? any reference link you could propose?
Thanks!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ngauthier/tubesock/issues/53#issuecomment-321384500, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA1Vv4lT9Iawxy8ypAS4Abi2Jt5yykQks5sWiJSgaJpZM4Oyn58 .
Thanks a lot!
Np
Hi, I am trying to use the gem in Rails 5+ inside a controller. I have so far just added the example code and tried to connect, but I am getting the error below. I am a beginner in ruby/rails and don't know what to do (sorry if it is a generic/trivial question).