I can not close my socket manually. It quits only when I close a tab in the browser.
Finished "/cable/" [WebSocket] for 127.0.0.1 at 2016-10-29 16:55:49 +0200
But when I call either
App.cable.subscriptions.remove(App.subscription)
or
App.subscription.unsubscribe()
the method "unsubscribed" in CommunityChannel
is being called, but the cable is still present and I can still print it in my function "print_socket"
How to manually close the connection?
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
end
protected
def find_verified_user
if current_user = User.find_by(id: cookies.signed[:user_id])
current_user
else
reject_unauthorized_connection
end
end
end
end