Class: Hippo::API::Cable::Connection

Inherits:
ActionCable::Connection::Base
  • Object
show all
Defined in:
lib/hippo/api/cable.rb

Instance Method Summary collapse

Instance Method Details

#connectObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/hippo/api/cable.rb', line 16

def connect
    token = request.params['token']
    begin
        self.current_user = User.for_jwt_token(token) if token
    rescue JWT::DecodeError
    end
    unless self.current_user
        Hippo.logger.warn("Rejecting ws connection due to unauthorized access")
        reject_unauthorized_connection
    end
end