All threads / Rails actioncable registered connection issue

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails actioncable registered connection issue

Lee Terng Gio asked in Rails

I'm implementing ActionCable in my Rails app. I'm facing an issue with Registered Connection error. I'm using MongoID in my Rails app.

Here is my connection.rb

module ApplicationCable
  class Connection < ActionCable::Connection::Base
   identified_by :current_user

def connect
  self.current_user = find_verified_user
  logger.add_tags "ActionCable", "User #{current_user.id}"
end

protected

def find_verified_user
 current_user = User.find_by(cookies.signed[:user_id])
  if current_user
    current_user
  else
    reject_unauthorized_connection
  end  
end

  end
end

Here is my logs

Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: upgrade, HTTP_UPGRADE: websocket)
MONGODB | [52] localhost:27017 #1 | dashtree_development.find | STARTED | {"find"=>"users", "filter"=>{"_id"=>BSON::ObjectId('5e3f6782f026752069ba5c21')}, "lsid"=>{"id"=><BSON::Binary:0x47104983206780 type=uuid data=0xac31709d0cea4a74...>}}
MONGODB | [52] localhost:27017 | dashtree_development.find | SUCCEEDED | 0.000s
[ActionCable] [User 5e3f6782f026752069ba5c21] Registered connection (#<User:0x00007f09400c49c8>)
[ActionCable] [User 5e3f6782f026752069ba5c21] ChatroomsChannel is transmitting the subscription confirmation
[ActionCable] [User 5e3f6782f026752069ba5c21] ChatroomsChannel is streaming from chatrooms:5e3f6782f026752069ba5c21

There is an issue with Registered connection (#<User:0x00007f09400c49c8>). I'm still unable to find a solution on this.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,344+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.